#include <bits/stdc++.h> using namespace std; int n,m,k; int dfsh(int x,int res){ if(x==k) return res; if(res==n) dfsh(1+m,1); printf("res in h = %d n in h = %d\n",res,n); dfsh(x+1,res+1); dfsh(x+m,res+1); } int dfsl(int x,int res){ printf("res in l = %d n in l = %d\n",res,n); if(x==k) return res; if(res==m) dfsh(x-m,1); dfsh(x+1,res+1); dfsh(x-m,res+1); } int main() { scanf("%d%d%d",&n,&m,&k); printf("%d %d\n", dfsh(1,1),dfsl(n*m+1-m,1)); return 0; }