#include<bits/stdc++.h>
using namespace std;
int main(){
  int h,w,n,masu[1000][1000];
  while(scanf("%d %d %d",&h,&w,&n),h!=0||w!=0||n!=0){
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	scanf("%d",&masu[i][j]);
      }
    }
    int dp[1000][1000]={};
    dp[0][0] = n-1;
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	if(i > 0){
	  if(dp[i-1][j]%2 == 0){
	    dp[i][j] += dp[i-1][j]/2;
	  } else {
	    if(masu[i-1][j] == 0){
	      dp[i][j] += (dp[i-1][j]+1)/2;
	    } else {
	      dp[i][j] += dp[i-1][j]/2;
	    }
	  }
	}
	if(j > 0){
	  if(dp[i][j-1]%2 == 0){
	    dp[i][j] += dp[i][j-1]/2;        
	  } else {
	    if(masu[i][j-1] == 1){
	      dp[i][j] += (dp[i][j-1]+1)/2;
	    } else {
	      dp[i][j] += dp[i][j-1]/2;
	    }
	  }
	}
      }
    }
    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	masu[i][j] = (masu[i][j]+dp[i][j])&1;
      }
    }
    int y=0,x=0;
    while(y<h&&x<w){
      if(masu[y][x] == 1) x++;
      else y++;
    }
    printf("%d %d\n",y+1,x+1);
  }
  return(0);
}

