#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<map>
#include<stack>

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,n) for(int i=1;i<=n;i++)

		int dp[1003][1003];
		int masu[1003][1003];
int main(){
	while(1){
		int n,m,k;
		scanf("%d%d%d",&n,&m,&k);
		if(n==0)break;
		rep(i,1003)rep(j,1003)masu[i][j]=dp[i][j]=0;
		rep(i,n){
			rep(j,m){
				scanf("%d",&masu[j][i]);
			}
		}
		
		dp[0][0]=k-1;
		
		rep(i,m){
			rep(j,n){
				dp[i+1][j]+=dp[i][j]/2;
				dp[i][j+1]+=dp[i][j]/2;
				
				if(dp[i][j]%2==1){
					if(masu[i][j]==0){
						dp[i][j+1]++;
					}else{
						dp[i+1][j]++;
					}
				}
				masu[i][j]+=dp[i][j];
				masu[i][j]%=2;
			}
		}
		
		int x=0,y=0;
		while(1){
			if(masu[x][y]==0){
				y++;
			}else{
				x++;
			}
			if(y>=n || x>=m){
				break;
			}
		}
		printf("%d %d\n",y+1,x+1);
	}
}

/*
3 4 3
1 0 1 1
0 1 0 0
1 0 1 0

*/