#include <bits/stdc++.h>

using namespace std;

int H, W, N;
int MapData[1000][1000];
int DpDirection[1001][1001];

void solve(int curRow, int curCol) {

	if (curRow == H || curCol == W) {
		cout << curRow + 1 << " " << curCol + 1 << endl;
		return;
	}

	if (MapData[curRow][curCol] == 1) {
		if (DpDirection[curRow][curCol] % 2 == 1) {
			++curCol;
		}
		else {
			++curRow;
		}
	}
	else {
		if (DpDirection[curRow][curCol] % 2 == 1) {
			++curRow;
		}
		else {
			++curCol;
		}
	}
	solve(curRow, curCol);
}

int main() {

	while (cin >> H >> W >> N, H) {
		for (int i = 0; i < H; ++i) {
			for (int j = 0; j < W; ++j) {
				cin >> MapData[i][j];
			}
		}

		memset(DpDirection, 0, sizeof(DpDirection));
		DpDirection[0][0] = N;
		for (int i = 0; i < H; ++i) {
			for (int j = 0; j < W; ++j) {
				if (MapData[i][j] == 1) {
					DpDirection[i][j + 1] += DpDirection[i][j] - DpDirection[i][j] / 2;
					DpDirection[i + 1][j] += DpDirection[i][j] / 2;
				}
				else if (MapData[i][j] == 0) {
					DpDirection[i][j + 1] += DpDirection[i][j] / 2;
					DpDirection[i + 1][j] += DpDirection[i][j] - DpDirection[i][j] / 2;
				}
			}
		}

		solve(0, 0);
	}

	return 0;
}
