#include<iostream>
using namespace std;
class map{
public:
    bool dotti;
    int num;
};
int main(){
    int H,W,N;
    map **walk;
    while(cin>>H>>W>>N&&H!=0){
        walk=new map*[H+1];
        walk[0]=new map[W+1];
        for(int i=1;i<=H;++i){
            walk[i]=new map[W+1];
            for(int j=1;j<=W;++j){
                cin>>walk[i][j].dotti;
                walk[i][j].num=0;
            }
        }
        for(int i=0;i<=H;++i){
            walk[i][0].dotti=0;
            walk[i][0].num=0;
        }
        for(int i=0;i<=W;++i){
            walk[0][i].dotti=0;
            walk[0][i].num=0;
        }
        walk[1][1].num=N-1;
        for(int i=1;i<=H;++i){
            for(int j=1;j<=W;++j){
                walk[i][j].num+=(walk[i][j-1].dotti)?(walk[i][j-1].num+1)/2:walk[i][j-1].num/2;
                walk[i][j].num+=(walk[i-1][j].dotti)?walk[i-1][j].num/2:(walk[i-1][j].num+1)/2;
            }
        }
        for(int i=1;i<=H;++i){
            for(int j=1;j<=W;++j){
                if(walk[i][j].num%2){
                    walk[i][j].dotti=!walk[i][j].dotti;
                }
            }
        }
        //W=?¨?0H=???1
        int answer[]{1,1};
        while(answer[0]<=W&&answer[1]<=H){
            if(walk[answer[1]][answer[0]].dotti==1){
                ++answer[0];
            }else{
                ++answer[1];
            }
        }
        cout<<answer[1]<<' '<<answer[0]<<endl;
        for(int i=0;i<=H;++i){
            delete[] walk[i];
        }
        delete[] walk;
    }
    return 0;
}