#E. ABC200E - Patisserie ABC 2

    Type: Default 1000ms 256MiB

ABC200E - Patisserie ABC 2

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Score : 500 points

Problem Statement

Takahashi, a pastry chef at ABC Confiserie, has decided to make cakes to celebrate AtCoder Beginner Contest 200.

A cake made by Takahashi has three parameters: beauty, taste, and popularity, each of which is represented by an integer between 1 and N (inclusive).

He has made a cake of beauty i, taste j, and popularity k for every triple (i,j,k) (1i,j,kN).
Then, he has arranged these N3 cakes in a row, as follows:

  • The cakes are in ascending order of sum of beauty, taste, and popularity from left to right.
  • For two cakes with the same sum of beauty, taste, and popularity, the cake with the smaller beauty is to the left.
  • For two cakes with the same sum and the same beauty, the cake with the smaller taste is to the left.

Find the beauty, taste, and popularity of the K-th cake from the left.

Constraints

  • All values in input are integers.
  • 1N106
  • 1KN3

Input

Input is given from Standard Input in the following format:

N K

Output

Print three integers representing the cake's beauty, taste, popularity, in this order, with spaces in between.


Sample Input 1

2 5

Sample Output 1

1 2 2

The cakes are in the following order:

(1,1,1),(1,1,2),(1,2,1),(2,1,1),(1,2,2),(2,1,2),(2,2,1),(2,2,2).

Here, each triple of integers represents the beauty, taste, and popularity of a cake.


Sample Input 2

1000000 1000000000000000000

Sample Output 2

1000000 1000000 1000000

The values in input may be large.


Sample Input 3

9 47

Sample Output 3

3 1 4

摸底测试

Not Attended
Status
Done
Rule
IOI
Problem
8
Start at
2023-8-3 8:30
End at
2023-8-3 11:30
Duration
3 hour(s)
Host
Partic.
15