import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int ori[][] = new int[N][N];
int copy[][] = new int[N][N];
int a = 0, b = 0;
int zero = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
ori[i][j] = sc.nextInt();
copy[i][j] = ori[i][j];
if (ori[i][j] == 1)
zero = 1;
}
}
int check = 0;
for (int size = 1; size <= N; size++) {
for (int i = 1; i < N; i++) {
for (int j = 1; j < N; j++) {
if (ori[i][j] == size) {
if (ori[i][j - 1] == size && ori[i - 1][j] == size && ori[i - 1][j - 1] == size) {
copy[i][j] = size + 1;
a = i;
b = j;
check = 1;
}
}
}
}
if (zero == 0) {
System.out.println("0 0 0");
break;
}
else if (check == 0) {
System.out.println((a - size + 1) + " " + (b - size + 1) + " " + size);
break;
}
check = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
ori[i][j] = copy[i][j];
}
}
}
}
}