#include "bits/stdc++.h"

using namespace std;
#define rep(i, n) for(int i = 0; i < signed(n); i++)
#define rrep(i, n) for(int i = signed(n) - 1; i >= 0; i--)
#define all(co) co.begin(), co.end()
#define int long long
//using LL = long long;
//using P = pair < int, int > ;
//using PI = pair < P, int > ;
typedef pair<int, int> P;
typedef long long LL;
typedef pair<P, int> PI;
typedef pair<int, P> IP;
const int INF = 1 << 29;
const LL LINF = 1ll << 62ll;

struct edge{ int from, to, cost; };

int dr[] = { -1, 0, 1, 0 };
int dc[] = { 0, 1, 0, -1 };

template<typename T = int>
vector<vector<T>> vvector(int h, int w, T def = T()){ return move(vector<vector<T>>(h, vector<T>(w, def))); }
class range {
private: struct I{ int x; int operator*(){ return x; }bool operator!=(I& lhs){ return x < lhs.x; }void operator++(){ ++x; } }; I i, n;
public:range(int n) :i({ 0 }), n({ n }){}range(int i, int n) :i({ i }), n({ n }){}I& begin(){ return i; }I& end(){ return n; }
};

signed main()
{
	int h, w;
	while (cin >> h >> w && h)
	{
		int n; cin >> n;
		auto stage = vvector<int>(h, w);
		rep(i, h)rep(j, w) cin >> stage[i][j];
		auto dp = vvector(h + 1, w + 1);

		dp[0][0] = n - 1;
		rep(i, h)
		{
			rep(j, w)
			{
				bool rem = dp[i][j] % 2;
				dp[i][j + 1] += dp[i][j] / 2 + (rem ? stage[i][j] : 0);
				dp[i + 1][j] += dp[i][j] / 2 + (rem ? !stage[i][j] : 0);
			}
		}

		rep(i, h) rep(j, w) stage[i][j] = (stage[i][j] + dp[i][j]) % 2;
		P now = P(0, 0);
		while (now.first != h && now.second != w)
		{
			if (stage[now.first][now.second]) now.second++;
			else now.first++;
		}
		cout << now.first + 1 << " " << now.second + 1 << endl;
	}

	return 0;
}