#include
using namespace std;
int main(){
int m[3][5]; int max = 0, maxNum[2] = {0, 0};
int min = 0, minNum[2] = {0, 0};
for (int i = 0; i < 3; i ++) {
for (int j = 0; j < 5; j ++) {
scanf("%d", &m[i][j]);
if (i == 0 && j == 0) {
max = m[i][j];
min = m[i][j];
}
if (m[i][j] > max){
max = m[i][j];
maxNum[0] = i;
maxNum[1] = j;
}
if (m[i][j] < min){
min = m[i][j];
minNum[0] = i;
minNum[1] = j;
}
}
}
cout<< max<<" "<cout< return 0;
}