// Slower C++ solution:
#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <cmath>

#include <climits>

#include <cfloat>

#include <ctime>

#include <map>

#include <utility>

#include <set>

#include <iostream>

#include <memory>

#include <string>

#include <vector>

#include <algorithm>

#include <functional>

#include <sstream>

#include <complex>

#include <stack>

#include <queue>

#include <numeric>



using namespace std;



#ifdef _MSC_VER

#define __typeof__ decltype



template <class T>

int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }

#endif



#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)

#define all(c) (c).begin(), (c).end()

#define rall(c) (c).rbegin(), (c).rend()

#define popcount __builtin_popcount



template <class T> void max_swap(T& a, const T b) { a = max(a, b); }

template <class T> void min_swap(T& a, const T b) { a = min(a, b); }



const double EPS = 1e-10;

typedef long long ll;

typedef pair<int, int> pint;





int main()

{

	int h, w, n;

	while (scanf("%d%d%d", &h, &w, &n), h | w | n)

	{

		static bool east[1024][1024];

		for (int i = 0; i < h; ++i)

		{

			for (int j = 0; j < w; ++j)

			{

				int t;

				scanf("%d", &t);

				east[i][j] = t == 1;

			}

		}



		static int visit[1024][1024];

		memset(visit, 0, sizeof(visit));

		visit[0][0] = --n;

		for (int i = 0; i < h; ++i)

		{

			for (int j = 0; j < w; ++j)

			{

				int a = visit[i][j] / 2, b = (visit[i][j] + 1) / 2;

				if (east[i][j])

					swap(a, b);

				visit[i][j + 1] += a;

				visit[i + 1][j] += b;



				east[i][j] ^= visit[i][j] & 1;

			}

		}



		int x, y;

		x = y = 0;

		while (x < w && y < h)

		{

			if (east[y][x])

				++x;

			else

				++y;

		}

		printf("%d %d\n", ++y, ++x);

	}

}

// Faster C++ solution for the same problem (measured speedup: 5.327779598265296x):
#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <cmath>

#include <climits>

#include <cfloat>

#include <ctime>

#include <map>

#include <utility>

#include <set>

#include <iostream>

#include <memory>

#include <string>

#include <vector>

#include <algorithm>

#include <functional>

#include <sstream>

#include <complex>

#include <stack>

#include <queue>

#include <numeric>



using namespace std;



#ifdef _MSC_VER

#define __typeof__ decltype



template <class T>

int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }

#endif



#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)

#define all(c) (c).begin(), (c).end()

#define rall(c) (c).rbegin(), (c).rend()

#define popcount __builtin_popcount



template <class T> void max_swap(T& a, const T b) { a = max(a, b); }

template <class T> void min_swap(T& a, const T b) { a = min(a, b); }



const double EPS = 1e-10;

typedef long long ll;

typedef pair<int, int> pint;





int main()

{

	int h, w, n;

	while (scanf("%d%d%d", &h, &w, &n), h | w | n)

	{

		static bool east[1024][1024];

		for (int i = 0; i < h; ++i)

		{

			for (int j = 0; j < w; ++j)

			{

				int t;

				scanf("%d", &t);

				east[i][j] = t == 1;

			}

		}



		static int visit[1024][1024];

		for (int i = 0; i < h; ++i)

			for (int j = 0; j < w; ++j)

				visit[i][j] = 0;



		visit[0][0] = --n;

		for (int i = 0; i < h; ++i)

		{

			for (int j = 0; j < w; ++j)

			{

				int a = visit[i][j] / 2, b = (visit[i][j] + 1) / 2;

				if (east[i][j])

					swap(a, b);

				visit[i][j + 1] += a;

				visit[i + 1][j] += b;



				east[i][j] ^= visit[i][j] & 1;

			}

		}



		int x, y;

		x = y = 0;

		while (x < w && y < h)

		{

			if (east[y][x])

				++x;

			else

				++y;

		}

		printf("%d %d\n", ++y, ++x);

	}

}