#include <bits/stdc++.h> using namespace std; int main() { int data[4][5]; for (int i = 0; i < 4; i++) for (int j = 0; j < 5; j++) cin >> data[i][j]; int res[11]; vector<int> tmp; for (int j = 0 ; j < 5; j++) { tmp.clear(); for (int i = 0; i < 4; i++) { tmp.push_back(data[i][j]); } tmp.erase(min_element(tmp.begin(), tmp.end())); tmp.erase(min_element(tmp.begin(), tmp.end())); res[2 * j] = tmp[0]; res[2 * j + 1] = tmp[1]; } for (int i = 0; i < 10; i += 2) { cout << res[i] << " "; } cout << endl; for (int i = 1; i < 10; i += 2) { cout << res[i] << " "; } }