#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct cooldinate {
int x;
int y;
int z;
};
struct cooldinate cooldi[30000];
int s[105][105][105] = {};
int onecount = 0;//배열의 1의 갯수를 파악하는 변수
int front = 0;
int rear = 0;
void Enque(int x, int y, int z);
struct cooldinate Deque(void);
void spread(struct cooldinate[]);
int main() {
int n, m, h;
scanf("%d %d %d", &m, &n, &h);
for (int i = 0; i <= h + 1; i++) {
for (int j = 0; j <= n + 1; j++) {
for (int k = 0; k <= m + 1; k++) {
if (i == 0 || i == h + 1)
s[i][j][k] = -1;
else if (j == 0 || j == n + 1)
s[i][j][k] = -1;
else if (k == 0 || k == m + 1)
s[i][j][k] = -1;
else {
scanf("%d", &s[i][j][k]);
if (s[i][j][k] == 1) {
onecount++;
Enque(i, j, k);
}
}
}
}
}
////스캔 데이터 테스트 케이스
//for (int i = 0; i <= h + 1; i++) {
// for (int j = 0; j <= n + 1; j++) {
// for (int k = 0; k <= m + 1; k++) {
// printf("%d ", s[i][j][k]);
// }
// printf("\n");
// }
//}
////원카운트 테스트 케이스
//printf("%d", onecount);
//디큐 테스트 케이스
struct cooldinate s;
s = Deque();
spread(Deque());
printf("%d %d %d", s.x, s.y, s.z);
}
void Enque(int x, int y, int z) {
rear++;
cooldi[rear].x = x;
cooldi[rear].y = y;
cooldi[rear].z = z;
}
struct cooldinate Deque(void) {
front++;
if (s[cooldi[front].x + 1][cooldi[front].y][cooldi[front].z] == 0)
Enque(cooldi[front].x + 1, cooldi[front].y, cooldi[front].z);
if (s[cooldi[front].x - 1][cooldi[front].y][cooldi[front].z] == 0)
Enque(cooldi[front].x + 1, cooldi[front].y, cooldi[front].z);
if (s[cooldi[front].x][cooldi[front].y + 1][cooldi[front].z] == 0)
Enque(cooldi[front].x, cooldi[front].y + 1, cooldi[front].z);
if (s[cooldi[front].x][cooldi[front].y - 1][cooldi[front].z] == 0)
Enque(cooldi[front].x, cooldi[front].y - 1, cooldi[front].z);
if (s[cooldi[front].x][cooldi[front].y][cooldi[front].z + 1] == 0)
Enque(cooldi[front].x, cooldi[front].y, cooldi[front].z + 1);
if (s[cooldi[front].x][cooldi[front].y][cooldi[front].z - 1] == 0)
Enque(cooldi[front].x, cooldi[front].y, cooldi[front].z - 1);
return cooldi[front];
}
void spread(struct cooldinate cooldi) {
}