#include <iostream>
#include <cstring>

using namespace std;

#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)

int a[1005][1005];
int dp[1005][1005]; // dp[i][j] := N-1???????????§???(i, j)??????????????£??????

int main()
{
	int H, W, N;
	
	while (cin >> H >> W >> N, H) {
		memset(dp, 0, sizeof dp);

		rep(i, H) rep(j, W) cin >> a[i][j];

		dp[0][0] = N - 1;

		rep(i, H) rep(j, W) {
			if (i == 0 && j == 0) continue;

			if (i - 1 >= 0) {
				bool f = (dp[i - 1][j] % 2 == 0 ? a[i - 1][j] : !a[i - 1][j]) == 0;
				dp[i][j] += (f ? (dp[i - 1][j] / 2) : (dp[i - 1][j] + 1) / 2);
			}

			if (j - 1 >= 0) {
				bool f = (dp[i][j - 1] % 2 == 0 ? a[i][j - 1] : !a[i][j - 1]) == 1;
				dp[i][j] += (f ? dp[i][j - 1] / 2 : (dp[i][j - 1] + 1) / 2);
			}
		}

		rep(i, H) rep(j, W) {
			a[i][j] ^= dp[i][j] % 2;
		}

		int y = 0, x = 0;

		while (y < H && x < W) {
			(a[y][x] ? x : y)++;
		}

		cout << y + 1 << ' ' << x + 1 << endl;
	}
}