Seat Assignment

No attempts yetTime limit1sMemory limit256 MB

Problem

A concert hall has its seats laid out in a C×RC \times R grid, CC seats across and RR seats up. Each seat is identified by its grid coordinate (x,y)(x, y).

The figure below shows a 7×67 \times 6 layout with 7 seats across and 6 seats up. Each unit square is one seat, and the (x,y)(x, y) written inside it is that seat's number. The bottom left seat is (1,1)(1, 1) and the top right seat is (7,6)(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)(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)(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×67 \times 6 hall.

6789101112
5262728293013
4253839403114
3243742413215
2233635343316
1222120191817

Given the natural numbers CC and RR that describe the size of the hall, write a program that finds the seat number (x,y)(x, y) assigned to the audience member whose waiting number is KK.

Input

The first line contains the integers CC and RR, the grid size of the hall, in that order and separated by one space. Both values satisfy 5C,R1,0005 \le C, R \le 1{,}000.

The second line contains the waiting number KK of one audience member, where 1K100,000,0001 \le K \le 100{,}000{,}000.

Output

Find the seat number (x,y)(x, y) assigned to the audience member whose waiting number is KK, and print the two values xx and yy 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).