#include<cstdio>
#include<cstring>
#include<algorithm>
#include<functional>
using namespace std;
int za[1002][1002],suu[1002][1002];
int main(void)
{
	int i,j,h,w,n,x,y;
	while(1) {
		scanf("%d %d %d",&h,&w,&n);
		if(h==0 && w==0 && n==0) break;
		for(i=1;i<=h;i++) {
			for(j=1;j<=w;j++) {
				scanf("%d",&za[i][j]);
			}
		}
		for(i=1;i<=h;i++) {
			for(j=1;j<=w;j++) {
				suu[i][j]=0;
			}
		}
		suu[1][1]=n-1;
		for(i=1;i<=h;i++) {
			for(j=1;j<=w;j++) {
				if(suu[i][j]%2==0) {
					suu[i+1][j]+=suu[i][j]/2;
					suu[i][j+1]+=suu[i][j]/2;
				}
				else if(suu[i][j]%2==1) {
					if(za[i][j]==0) {
						suu[i+1][j]+=suu[i][j]/2+1;
						suu[i][j+1]+=suu[i][j]/2;
						za[i][j]=1;
					}
					else {
						suu[i][j+1]+=suu[i][j]/2+1;
						suu[i+1][j]+=suu[i][j]/2;
						za[i][j]=0;
					}
				}		
			}
		}
		x=1;
		y=1;
		while(1) {
			if(za[x][y]==1) y++;
			else x++;
			if(x==h+1 || y==w+1) break;
		}
		printf("%d %d\n",x,y);
	}
	return 0;
}