#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
int main()
{
	while(1)
	{
		int H,W,N;
		cin >> H >> W >> N;
		if(H==0&&W==0&&N==0)break;
		int mp[H+2][W+2];
		int dp[H+2][W+2];
		for(int i=0;i<H+2;i++)
		{
			for(int j=0;j<W+2;j++)
			{
				mp[i][j]=-1;
			}
		}
		memset(dp,0,sizeof(dp));
		dp[1][1]=N-1;
		for(int i=1;i<=H;i++)
		{
			for(int j=1;j<=W;j++)
			{
				cin >> mp[i][j];
			}
		}
		for(int i=1;i<=H;i++)
		{
			for(int j=1;j<=W;j++)
			{
				if(dp[i][j]%2==1)
				{
					if(mp[i][j]==0)
					{
						dp[i+1][j]+=(dp[i][j]+1)/2;
						dp[i][j+1]+=(dp[i][j]-1)/2;
					}
					else
					{
						dp[i][j+1]+=(dp[i][j]+1)/2;
						dp[i+1][j]+=(dp[i][j]-1)/2;
					}
				}
				else
				{
					dp[i+1][j]+=dp[i][j]/2;
					dp[i][j+1]+=dp[i][j]/2;
				}
			}
		}
		int i=1,j=1;
		while(1)
		{
			if(mp[i][j]==-1)break;
			if(mp[i][j]&&dp[i][j]%2)i++;
			else if(mp[i][j]&&!(dp[i][j]%2))j++;
			else if(!mp[i][j]&&dp[i][j]%2)j++;
			else i++;
		}
		cout << i << ' ' << j << endl;
	}
	return 0;
}