An array is
usually stored in RAM as a sequence of its elements. Traditionally, the element
sequence is listed by rows or columns of the original array. However, in this
task we will iterate the elements of a two-dimensional array (a rectangular
matrix of size n*m) in a “spiral” fashion (see
figure) starting at cell (1,1).
Write a program
that will return the indices (row and column) of the element for given position
in the spiral sequence.


Limitations
1 <=
n, m <= 100; 1<= k <= n*m;
1 <= i <= n;
1 <= j <= m.
Input
The first line
of the input file contains three integers n, m
(matrix dimensions) and k (element position in a spiral sequence).
Output
The output file
must contain two integers i and j – the indices of
the array element corresponding to element number k in the spiral
sequence.
Sample
Standard input
|
Standard output
|
3 3 3
|
1 3
|
4 5 6
|
2 5
|