import std.stdio;
import std.string;
import std.array;
import std.algorithm;
import std.conv;

void main() {
    int H, W, N;
    while (readf("%d %d %d\n", &H, &W, &N), H || W || N) {
        int[][] F = new int[][H];
        foreach (ref L; F) L = readln.chomp.split(" ").map!(to!int).array;
        int[][] C = new int[][](H, W);
        void f() {
            foreach (y; 0 .. H) {
                foreach (x; 0 .. W) {
                    if (y - 1 >= 0) {
                        C[y][x] += (C[y - 1][x] + (F[y - 1][x] == 0)) / 2;
                    }
                    if (x - 1 >= 0) {
                        C[y][x] += (C[y][x - 1] + (F[y][x - 1] == 1)) / 2;
                    }
                }
            }
            foreach (y; 0 .. H) {
                foreach (x; 0 .. W) {
                    if (C[y][x] % 2) {
                        F[y][x] = !F[y][x];
                    }
                }
            }
        }
        C[0][0] = N - 1;
        f;
        int y = 0, x = 0;
        while (true) {
            if (F[y][x]) {
                x++;
            } else {
                y++;
            }
            if (y >= H || x >= W) {
                writeln(y + 1, " ", x + 1);
                break;
            }
        }
    }
}