#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reg(i,a,b) for(int i=(a);i<=(b);i++)
#define irep(i,n) for(int i=((int)(n))-1;i>=0;i--)
#define ireg(i,a,b) for(int i=(b);i>=(a);i--)
typedef long long int lli;
typedef pair<int,int> mp;
#define fir first
#define sec second
#define IINF INT_MAX
#define LINF LLONG_MAX

int map[1005][1005];
int dat[1005][1005];

int n;
int w,h;

int main(void){
	while(1){
		memset(map,0,sizeof(map));
		memset(dat,0,sizeof(dat));
		scanf("%d%d%d",&h,&w,&n);
		if(h==0)break;
		rep(y,h){
			rep(x,w){
				scanf("%d",&map[y][x]);
			}
		}
		dat[0][0]=n-1;
		rep(y,h){
			rep(x,w){
				int no = dat[y][x];
				dat[y+1][x]+=no/2;
				dat[y][x+1]+=no/2;
				if(no%2==1){
					if(map[y][x]==0){
						dat[y+1][x]++;
					}
					else{
						dat[y][x+1]++;
					}
					map[y][x]=1-map[y][x];
				}
			}
		}
		
		int x=0,y=0;
		while(x<w && y<h){
			if(map[y][x]==0)y++;
			else x++;
		}
		printf("%d %d\n",y+1,x+1);
	}
		
	return 0;
}