#include<iostream>
#include<cstdio>
using namespace std;

int main(){
	int H,W,N;
	int cMap[1013][1013];
	int Map[1013][1013];
	while(cin >> H >> W >> N && H && W && N){
	    for(int i=0;i<H+3;i++)for(int J=0;J<W+3;J++)cMap[J][i] = 0;
	    if(H+W+N == 0)break;
	    for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
		  cin >> Map[i][j];
		}
	    }
	    cMap[1][1] = N;//奇数ならそのまま偶数なら別
	    for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){

		    cMap[i][j+1] += cMap[i][j]/2; 
		    cMap[i+1][j] += cMap[i][j]/2;
		    if(cMap[i][j]%2 != 0 ){
			if(Map[i][j] == 1){
			    cMap[i][j+1]++;
			}
			else {
			    cMap[i+1][j]++;
			}
		    }
		}
	    }
	  
	    int x,y;
	    x = y = 1;
	    while(1<= y && y <= H && 1<= x && x<= W){
		if(cMap[y][x]%2 == 0){
		    if(Map[y][x] == 1)y++;
		    else x++;
		}
		else{
		    if(Map[y][x] == 1)x++;
		    else y++;
		    
		}
	    }
	    cout << y << " " << x << endl;

	}



  return 0;
}