选择最大值即可
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x = 0, y = 0, a;
scanf("%d", &n);
for (int i = 1;i <= n; i++) scanf("%d", &a), x = max(x, a);
scanf("%d", &n);
for (int i = 1;i <= n; i++) scanf("%d", &a), y = max(y, a);
printf("%d %d", x, y);
return 0;
}