#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

bool map[1001][1001];

int flow[1001][1001];

int H, W, n;

void search(int x, int y){
	if(x >= W || y >= H){
		printf("%d %d\n", y + 1, x + 1);
		return;
	}
	if(map[y][x]){
		search(x + 1, y);
	}else{
		search(x, y + 1);
	}
}

int main(){
	
	while(true){
		cin >> H >> W >> n;
		if(H == 0 && W == 0 && n == 0){
			break;
		}
		int d;
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				cin >> d;
				if(d == 1){
					map[i][j] = true;
				}else{
					map[i][j] = false;
				}
				flow[i][j] = 0;
			}
		}
		
		flow[0][0] = n - 1;
		
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				if(flow[i][j] % 2 == 0){
					flow[i + 1][j] += flow[i][j] / 2;
					flow[i][j + 1] += flow[i][j] / 2;
				}else{
					if(map[i][j]){
						flow[i + 1][j] += flow[i][j] / 2;
						flow[i][j + 1] += flow[i][j] / 2 + 1;
					}else{
						flow[i + 1][j] += flow[i][j] / 2 + 1;
						flow[i][j + 1] += flow[i][j] / 2;
					}
					map[i][j] = !map[i][j];
				}
			}
		}
		search(0, 0);
	}
	
	return 0;
}