#include <cstdio>
#include <iostream>
#include <cstdlib>
using namespace std;

const int maxn = 2005;
int n;
int arr[maxn][maxn];

bool used[maxn];

int s[maxn][maxn];

void read() {
    scanf("%d", &n);\
    //s[0][0]=0;
    for (int j, i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
            scanf("%d", &(arr[i][j]));
            if(used[arr[i][j]]) arr[i][j] *= -1;
            else used[arr[i][j]] = true;

            s[i][j] = arr[i][j];
            if(j!=0) s[i][j] += s[i][j-1];
            if(i!=0) s[i][j] += s[i-1][j];
             if(i!=0 && j!=0) s[i][j] -= s[i-1][j-1];
        }
    }
}
void printarr() {
    for (int j, i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
                cout << arr[i][j] << " ";

        }
        cout << endl;
    }
}

void printS() {
    for (int j, i = 0; i < n; i++) {
        for (j = 0; j < n; j++) {
                cout << s[i][j] << " ";

        }
        cout << endl;
    }
}

int getSum(int a, int b, int c, int d) {
    return s[c][d] - s[a-1][d] - s[c][b-1] + s[a-1][b-1];
}

void solve() {
    for(int side = n-2; side >= 2; side -= 2) {
        for(int j, i = 1; i+side < n; i++) {
            for(j = 1; j+side < n; j++) {
                if(s[i+side-1][j+side-1] - s[i-1][j+side-1] - s[i+side-1][j-1] + s[i-1][j-1]==0) {
                    printf("%d %d %d\n", side, i+1, j+1);
                    exit(0);
                }
            }
        }
    }
}

int main() {
    read();
    //printarr();
    //cout << endl;
    //printS();
    solve();

    return 0;
}
