A concert hall has its seats laid out in a C×R grid, C seats across and R seats up. Each seat is identified by its grid coordinate (x,y).
The figure below shows a 7×6 layout with 7 seats across and 6 seats up. Each unit square is one seat, and the (x,y) written inside it is that seat's number. The bottom left seat is (1,1) and the top right seat is (7,6).
| (1, 6) | (7, 6) | |||||
| (4, 4) | (7, 4) | |||||
| (1, 3) | (6, 3) | |||||
| (1, 2) | ||||||
| (1, 1) | (2, 1) | (3, 1) | (7, 1) |
Many people are waiting in line to enter the hall. Starting from the front of the line, they received waiting tickets numbered 1, 2, 3, 4 and so on. We seat these people in order, starting at seat (1,1) and moving clockwise through the empty seats. The rule in detail is as follows.
The first person, the one holding waiting number 1, is assigned seat (1,1). After that, the next people are assigned to the seats above, moving upward. When no empty seat is left above, assignment continues to the right. When no empty seat is left to the right, it continues downward. When no empty seat is left below, it continues to the left, filling the remaining empty seats. When no empty seat is left to the left, it goes upward again, and this process repeats until every seat is assigned.
The figure below shows the result of assigning waiting numbers 1 through 42 in the 7×6 hall.
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 5 | 26 | 27 | 28 | 29 | 30 | 13 |
| 4 | 25 | 38 | 39 | 40 | 31 | 14 |
| 3 | 24 | 37 | 42 | 41 | 32 | 15 |
| 2 | 23 | 36 | 35 | 34 | 33 | 16 |
| 1 | 22 | 21 | 20 | 19 | 18 | 17 |
Given the natural numbers C and R that describe the size of the hall, write a program that finds the seat number (x,y) assigned to the audience member whose waiting number is K.
The first line contains the integers C and R, the grid size of the hall, in that order and separated by one space. Both values satisfy 5≤C,R≤1,000.
The second line contains the waiting number K of one audience member, where 1≤K≤100,000,000.
Find the seat number (x,y) assigned to the audience member whose waiting number is K, and print the two values x and y separated by one space.
If every seat is already assigned and no seat can be given to that audience member, print 0 (the digit zero).