#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<queue>
#include<vector>
#include<algorithm>
#include<functional>


using namespace std;

int h,w,n;
int dp[1005][1005];
int fie[1005][1005];
int main(void){
	while(1){
		memset(dp,0,sizeof(dp));
		memset(fie,0,sizeof(fie));
		scanf("%d%d%d",&h,&w,&n);
		if(h==0)break;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++)scanf("%d",&fie[j][i]);
		}
		dp[0][0]=n-1;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				if(dp[j][i]%2==0){
					dp[j+1][i]+=dp[j][i]/2;
					dp[j][i+1]+=dp[j][i]/2;
				}else{
					if(fie[j][i]==1){
						dp[j+1][i]+=(dp[j][i]+1)/2;
						dp[j][i+1]+=dp[j][i]/2;
					}
					if(fie[j][i]==0){
						dp[j+1][i]+=dp[j][i]/2;
						dp[j][i+1]+=(dp[j][i]+1)/2;
					}
				}
			}
		}
		int x=0,y=0;
		while(x<w && y<h){
			if((fie[x][y]+dp[x][y])%2==0)y++;
			else x++;
		}
		printf("%d %d\n",y+1,x+1);
	}
	return 0;
}