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

int H,W,N;
int field[1000][1000];	//東0,南1
int DP[1001][1001];
bool done[1001][1001] = {false};
//N-1回の散歩で通った回数を考える
void makeroot(int y,int x){
	if(y == H || x == W || done[y][x] == true)
		return;
	if((x==0&&y==0)||(x==0&&done[y-1][x])||(y==0&&done[y][x-1])||(x>0&&y>0&&done[y][x-1]&&done[y-1][x]))
		done[y][x] = true;
	else
		return;
	if(field[y][x]){
		DP[y][x+1] += (DP[y][x]+1)/2;
		DP[y+1][x] += DP[y][x]/2;
	}
	else{
		DP[y][x+1] += DP[y][x]/2;
		DP[y+1][x] += (DP[y][x]+1)/2;
	}
	makeroot(y,x+1);
	makeroot(y+1,x);
}
pair<int,int> walk(int y,int x){
	if(y == H || x == W){
		pair<int,int> p;
		p.first = y;
		p.second = x;
		return p;
	}
	if((field[y][x]+DP[y][x])%2)
		return walk(y,x+1);
	else
		return walk(y+1,x);
}
int main(){
	int i,j;
	pair<int,int> pos[200];
	int pcor = 0;
	while(1){
		cin>>H>>W>>N;
		if(H==0&&W==0&&N==0)
			break;
		for(i=0;i<H;i++){
			for(j=0;j<W;j++){
				cin>>field[i][j];
			}
		}
		for(i=0;i<=H;i++){
			for(j=0;j<=W;j++){
				DP[i][j]=0;
				done[i][j] = false;
			}
		}
		DP[0][0] = N-1;
		makeroot(0,0);
		pos[pcor] = walk(0,0);
		pcor++;
	}
	for(i = 0;i < pcor;i++)
		cout << pos[i].first+1 << " " << pos[i].second+1 << endl;
	return 0;
}