#include<iostream>
#include<algorithm>
using namespace std;
int main(){
long long a[6][6], min, x = 1, y[6] = {1, 1, 1, 1, 1, 1}, max;
bool flag = 1;
for (int i = 0; i < 5; i++){
for (int j = 0; j < 5; j++){
cin >> a[i][j];
if (!j){
max = a[i][j];
}
if (a[i][j] > max){
max = a[i][j];
y[i] = j + 1;
}
}
sort(a[i], a[i] + 5, greater<int>());
if (a[i][0] == a[i][1]){
flag = 0;
}
}
if (!flag){
cout << "not found";
return 0;
}
for (int i = 0; i < 5; i++){
if (!i){
min = a[i][0];
}
if (a[i][0] < min){
min = a[i][0];
x = i + 1;
}
}
cout << x << ' ' << y[x - 1] << ' ' << min;
}