#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
using namespace std;
int h,w,n;
int f[1111][1111];
int m[1111][1111];
int dx[] = {0,1};
int dy[] = {1,0};
int main(void){
  while(cin >> h >> w >> n && h){
    memset(m,0,sizeof(m));
    m[0][0] = n-1;
    for(int y = 0; y < h; y++){
      for(int x = 0; x < w; x++){
	cin >> f[x][y];
	for(int k = 0; k < 2; k++){
	  int nx = x + dx[k];
	  int ny = y + dy[k];
	  m[nx][ny] += (m[x][y] + ((f[x][y] == k)?1:0) )/2;
	}
	if(m[x][y] % 2) f[x][y] = (f[x][y]+1)%2;
      }
    }

    int x = 0,y = 0;
    while(x != w && y != h){
      int nx = x + dx[f[x][y]];
      int ny = y + dy[f[x][y]];
      x = nx;
      y = ny;
    }
    cout << y+1 << " " << x+1 << endl;
  }
}