#include #include #include using namespace std; int main() { int arr[4][4], n, num; vector input_numbers; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { cin >> arr[i][j]; } } cin >> n; for (int i = 0; i < n; i++) { cin >> num; input_numbers.push_back(num); } for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { input_numbers.push_back(arr[i][j]); } } sort(input_numbers.rbegin(), input_numbers.rend()); for (int i = 0; i < 16; i++) { if (i != 0 && i % 4 == 0) cout << endl; if (i != 0 && i % 4 != 0) cout << " "; cout << input_numbers[i]; } cout << endl; return 0; }