#include <fstream>
#include <vector>
#include <stdint.h>

using namespace std;

bool IsSymmetry(vector <vector <long long> > &a, int &x, int &y, int &size)
{
	for (int i = 0; i < size; i++)
	{
		for (int j = 0; j < size; j++)
		{
			if (a[y + i][x + j] != a[y + j][x + i])
			{
				return false;
			}
		}
	}
	return true;
}

int main()
{
	ifstream input("MTCDX.inp");
	ofstream output("MTCDX.out");
	int n;
	int size = INT32_MIN;
	int x, y;
	input >> n;
	vector <vector <long long> > a(n, vector <long long>(n));
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			input >> a[i][j];
		}
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			for (int k = 1; k <= ((n - i < n - j) ? n - i : n - j); k++)
			{
				if (IsSymmetry(a, j, i, k))
				{
					if (size < k)
					{
						size = k;
						x = j;
						y = i;
					}
				}
			}
		}
	}
	output << y + 1 << ' ' << x + 1 << ' ' << size;
	input.close();
	output.close();
	return 0;
}