#include <iostream>
using namespace std;
int main()
{
int maxa = -99999999, mina = 99999999;
int a[6][6] = {};
for (int i = 1; i <= 5; i++)
a[0][i] = mina;
for (int i = 1; i <= 5; i++)
a[i][0] = maxa;
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
cin >> a[i][j];
if (a[i][j] < a[0][j])
a[0][j] = a[i][j];
if (a[i][j] > a[i][0])
a[i][0] = a[i][j];
}
}
for (int i = 1; i <= 5; i++)
{
for (int j = 1; j <= 5; j++)
{
if (a[i][j] == a[i][0] && a[i][0] == a[0][j])
{
cout << i << " " << j << " " << a[i][j];
return 0;
}
}
}
cout << "not found";
return 0;
}