#include <bits/stdc++.h>
using namespace std;
bool ktdoixung(int a[100][100], int m)
{
    for (int i=0; i<m-1; i++)
        for (int j=i+1; j<m; j++)
            if (a[i][j]!=a[j][i])
                return false;
    return true;
}
int main ()
{
	freopen ("MTCDX.inp", "r" , stdin);
	freopen ("MTCDX.out" , "w", stdout);
	int b,c,d,n,m,max=1,x,p,q;
	cin>>n;
	int a[n+1][n+1];
	for (int i=1; i<=n; i++)
		for (int y=1; y<=n; y++)
			cin>>a[i][y];
	for (int i=1; i<=n; i++)
		for (int y=1; y<=n; y++)
			{
				if (i>=y) x=n-i+1; else x=n-y+1;
				for (int z=x; z>=max; z--)
				if ( ktdoixung(a[i][y],z)==true) {max=z; p=i; q=y; break;
				}
			}
		cout << p << " " << q << " " << max;
		
}

