#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <bitset>
#include <fstream>
#include <cmath>
#include <ctime>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define REP(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define MSG(a) cout << #a << " "  << a << endl;
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

int dp[1000][1000];

int main()
{
	int w, h, n;
	while(cin >> h >> w >> n && w)
	{
		memset(dp, 0, sizeof(dp));
		vector<vint> field(w, vint(h));

		rep(y, h) rep(x, w)
			cin >> field[x][y];

		dp[0][0] = n-1;
		rep(x, w) rep(y, h)
		{
			// ðKêéê
			if(x+1 < w) 
				dp[x+1][y] += (dp[x][y] + dp[x][y] % 2 * -(1 - field[x][y] * 2)) / 2;
			
			// ìðKêéê
			if(y+1 < h)
				dp[x][y+1] += (dp[x][y] + dp[x][y] % 2 *  (1 - field[x][y] * 2)) / 2;
		}

		pint p = make_pair(0,0);
		while(p.first < w && p.second < h)
		{
			if(dp[p.first][p.second] & 1)
				field[p.first][p.second] = !field[p.first][p.second]; 

			if(field[p.first][p.second])
				p.first++;
			else
				p.second++;
		}

		cout << p.second + 1 << " " << p.first + 1 << endl;
	}
}