You might have heard about the next game in Lara Croft series coming out this year. You also might have watched its trailer. Though you definitely missed the main idea about its plot, so let me lift the veil of secrecy.

Lara is going to explore yet another dangerous dungeon. Game designers decided to use good old 2D environment. The dungeon can be represented as a rectangle matrix of n rows and m columns. Cell (x, y) is the cell in the x-th row in the y-th column. Lara can move between the neighbouring by side cells in all four directions.

Moreover, she has even chosen the path for herself to avoid all the traps. She enters the dungeon in cell (1, 1), that is top left corner of the matrix. Then she goes down all the way to cell (n, 1) — the bottom left corner. Then she starts moving in the snake fashion — all the way to the right, one cell up, then to the left to the cell in 2-nd column, one cell up. She moves until she runs out of non-visited cells. n and m given are such that she always end up in cell (1, 2).

Lara has already moved to a neighbouring cell k times. Can you determine her current position?


-----Input-----

The only line contains three integers n, m and k (2 ≤ n, m ≤ 10^9, n is always even, 0 ≤ k < n·m). Note that k doesn't fit into 32-bit integer type!


-----Output-----

Print the cell (the row and the column where the cell is situated) where Lara ends up after she moves k times.


-----Examples-----
Input
4 3 0

Output
1 1

Input
4 3 11

Output
1 2

Input
4 3 7

Output
3 2



-----Note-----

Here is her path on matrix 4 by 3: [Image]

Difficulty: interview

Starter code:

Solutions:
n, m, k = map(int, input().split())
ans = 0, 0
if k < n:
    ans = k + 1, 1
else:
    k -= n
    r = n - k // (m - 1)
    if r % 2:
        c = m - k % (m - 1)
    else:
        c = 2 + k % (m - 1)
    ans = r, c
print(*ans)

n, m, k = map(int, input().split())
if k < n:
    print(k + 1, 1)
else:
    k -= n
    row = n - k // (m - 1)
    col = k % (m - 1)
    if row % 2 == 1:
        col = m - col
    else:
        col += 2
    print(row, col)

def inpmap():
    return list(map(int, input().split()))
n, m, k = inpmap()
if k < n:
    print(k + 1, 1)
else:
    k -= n
    a, b = divmod(k, (m - 1))
    print(n - a, m - b if a % 2 else b + 2)


n, m, k = [int(x) for x in input().split()]

if k < n:
    print(k+1, 1)
else:
    k -= n
    m -= 1
    i = k // m
    j = k % m
    
    print(n-i, 2+j if i % 2 == 0 else m+1 - j)


# python3

def readline(): return tuple(map(int, input().split()))


def main():
    n, m, k = readline()
    if k < n:
        print(k + 1, 1)
    else:
        k -= n
        q, r = divmod(k, m - 1)
        print(n - q, m - r if q & 1 else 2 + r)


main()


n, m, k = map(int, input().split())

if k <= n - 1:
	print(k + 1, 1)
	return

k -= n
m -= 1
l = k // m
c = k % m
if l % 2 == 1:
	c = m - 1 - c
l = n - l
print(l, c + 2)

n, m, k = list(map(int, input().split()))
if k < n:
    print(k+1, 1)
else:
    k = k-(n-1)
    tmp = k//(2*(m-1))
    k = k%(2*(m-1))
    x, y = n-2*tmp+1, 2
    if k > 0:
        x = x-1
        k = k-1
        if k <= m-2:
            y = y+k
        else:
            k = k-(m-1)
            x = x-1
            y = m-k
    print(x, y)


n,m,k = list(map(int,input().split()))
if k < n:print(k+1,1)
else:
    k-=n
    m-=1
    mo = k% (2*m)
    if mo >= m:
        mo = (2*m-1)-mo
    print(n-k//m,2+mo)


n, m, k = map(int, input().split())
if (k < n):
    print(k + 1, 1)
else:
    k -= n
    k2 = k // (m - 1)
    k1 = k % (2 * m - 2)
    if (k1 < m - 1):
        print(n - k2, k1 + 2)
    else:
        print(n - k2, (2 * m - 3 - k1) + 2)

n,m,k=list(map(int,input().split()))
if k < n:
    print(k+1,1)
elif (k-n)//(m-1)%2 == 0:
    print(n-(k-n)//(m-1), (k-n)%(m-1)+2)
else:
    print(n-(k-n)//(m-1), m-(k-n)%(m-1))


n,m,k = list(map(int,input().split()))

if k < n:
    print(1+k,1)
else:
    k -= n
    
    a = k % (2*(m-1))
    b = k // (2*(m-1))

    if a < m-1: # low
        print(n-2*b, 2+a)
    else:
        a -= (m-1)
        print(n-2*b-1,m-a)


n,m,k = list(map(int,input().split()))
if k < n:
    print(1+k,1)
else:
    k -= n
    k2 = k // (m-1)
    k3 = k % (m-1)
    if k2 % 2 == 0:
        print(n-k2,k % (m-1)+2)
    else:
        print(n-k2,m - k % (m-1))


n,m,k=map(int,input().split())
if (k<n):
      print(k+1," ",1,sep="")
else:
      k-=n
      if (m>=2):
            x=k//(m-1)
            if x%2==0:
                  a=k%(m-1) +2
                  b=n-x
            else:
                  a=(m-k%(m-1))
                  b=n-x
            print(b,a)
      


import sys
n,m,k=list(map(int,input().split()))

if(k<n):
    print(k+1,1)
    return
k-=n
x=n-(k)//(m-1)
if(x%2==0):
    y=k%(m-1)+2   
else:
    y=m-k%(m-1)
print(x,y)
    


H,W,K = list(map(int,input().split()))
if K < H:
    print(K+1,1)
    return
K -= H
W -= 1
d,m = divmod(K,(W*2))
if m < W:
    print(H-2*d, 2+m)
else:
    m -= W
    print(H-1-2*d, W-m+1)


n, m, k = list(map(int, input().split(" ")))

if k < n:
    print(k + 1, 1)
else:
    step = k - n
    #print("step:", step)
    row = step // (m - 1) + 1
    col = step % (m - 1)
    reverse = (row % 2 + 1) % 2
    #print("row", row, "col", col, "left", reverse)
    if reverse:
     #   print("rev", col)
        col = (m - 1) - col - 1
    print(n - row + 1, 2 + col)


def main():
    n, m, k = [int(i) for i in input().split(' ')]
   
    if k < n:
        print(k + 1, 1)
    else:
        k -= n
        m -= 1
        h1 = k // (2 * m) * 2
        h2 = k % (2 * m)
        if h2 < m:
            print(n - h1, 2 + h2)
        else:
            print(n - h1 - 1, 1 + m - h2 % m)

main()


n, m, k = list(map(int, input().split()))
r, c = None, None
if k < n:
    r, c = k+1, 1
else:
    k -= n
    a, b = k // (m-1), k % (m-1)
    r = n - a
    if a % 2 == 0:
        c = b + 2
    else:
        c = m - b
print(r, c)


(n, m, k) = list(map(int, input().split()))

if k <= n - 1:
    print(1 + k, 1)
else:
    k -= n
    d = k // (m - 1)
    k %= (m - 1)
    if d % 2 == 0:
        print(n - d, k + 2)
    else:
        print(n - d, m - k)


n, m, k = list(map(int, input().split()))
if k < n:
    r = [k + 1, 1]
else:
    m -= 1
    k -= n
    y, x = divmod(k, m)
    r = [n - y, 0]
    if y & 1:
        r[1] = m - x + 1
    else:
        r[1] = x + 2
print(*r)



n,m,k = list(map(int,input().split()))



current = n*m - 1
if k < n:
    print(k+1,1)
else:
    remaining = k - n
    row_from_down = remaining // (m-1)

    row = n - row_from_down
    # 11 10
    if row%2:
        col = remaining % (m-1)
        col = m - col

    else:
        col = remaining % (m-1)
        col += 2
    print(row, col)



n, m, k = map(int, input().split())
if k <= n - 1:
    print(1 + k, 1)
elif k <= n + m - 2:
    print(n, k - (n - 1) + 1)
else:
    k -= n - 1
    k -= m - 1
    #print('k', k)
    step = 1 + m - 2 + 1 + m - 2
    dy = k // (step // 2)
    y = n - dy
    if k % (step // 2):
        y -= 1
    k %= step
    if k == 0: 
        x = m
    else:
        k -= 1
        if k <= m - 2:
            x = m - k
        else:
            k -= 1 + m - 2
            #print('k', k)
            x = 1 + k + 1
    print(y, x)

n, m, k = [int(i) for i in input().split(' ')]

if k < n:
    print(k+1, 1)
else:
    k = k - n
    level, remainder = divmod(k, m-1)
    x = n - level
    direction = level % 2
    if direction == 0:
        y = remainder + 2
    else:
        y = m - remainder
    print(x, y)


n,m,t3=map(int,input().split())
if (t3<n): 
      print(1+t3," ",1,sep="")
else:
      t3-=n
      if (m>=2):
            x=t3//(m-1)
            if x%2==0:
                  a=t3%(m-1) +2
                  b=n-x
            else:
                  a=(m-t3%(m-1))
                  b=n-x
            print(b,a)