#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j;
  int a[1000][1000],b[1001][1001],h,w,n,x,y;
  while(cin>>h>>w>>n&&h+w+n){
    for(i=0;i<h;i++)
      for(j=0;j<w;j++)
	cin>>a[j][i];
    memset(b,0,sizeof(b));
    b[0][0]=n;
    for(i=1;i<w+h;i++){
      x=i-1;
      y=0;
      for(j=0;j<i;j++){
	if(x<w&&y<h){
	  if(b[x][y]%2){
	    if(a[x][y]){
	      a[x][y]=0;
	      b[x+1][y]+=b[x][y]/2+1;
	      b[x][y+1]+=b[x][y]/2;
	    }else{
	      a[x][y]=1;
	      b[x+1][y]+=b[x][y]/2;
	      b[x][y+1]+=b[x][y]/2+1;
	    }
	  }else{
	    b[x+1][y]+=b[x][y]/2;
	    b[x][y+1]+=b[x][y]/2;
	  }
	}
	x--;
	y++;
      }
    }
    for(x=y=0;x!=w&&y!=h;){
      if(a[x][y])
	y++;
      else
	x++;
    }
    cout<<y+1<<" "<<x+1<<endl;
  }
  return 0;
}