You are given an array $A$, consisting of $n$ positive integers $a_1, a_2, \dots, a_n$, and an array $B$, consisting of $m$ positive integers $b_1, b_2, \dots, b_m$. 

Choose some element $a$ of $A$ and some element $b$ of $B$ such that $a+b$ doesn't belong to $A$ and doesn't belong to $B$. 

For example, if $A = [2, 1, 7]$ and $B = [1, 3, 4]$, we can choose $1$ from $A$ and $4$ from $B$, as number $5 = 1 + 4$ doesn't belong to $A$ and doesn't belong to $B$. However, we can't choose $2$ from $A$ and $1$ from $B$, as $3 = 2 + 1$ belongs to $B$.

It can be shown that such a pair exists. If there are multiple answers, print any.

Choose and print any such two numbers.


-----Input-----

The first line contains one integer $n$ ($1\le n \le 100$) — the number of elements of $A$.

The second line contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 200$) — the elements of $A$.

The third line contains one integer $m$ ($1\le m \le 100$) — the number of elements of $B$.

The fourth line contains $m$ different integers $b_1, b_2, \dots, b_m$ ($1 \le b_i \le 200$) — the elements of $B$.

It can be shown that the answer always exists.


-----Output-----

Output two numbers $a$ and $b$ such that $a$ belongs to $A$, $b$ belongs to $B$, but $a+b$ doesn't belong to nor $A$ neither $B$.

If there are multiple answers, print any.


-----Examples-----
Input
1
20
2
10 20

Output
20 20
Input
3
3 2 2
5
1 5 7 7 9

Output
3 1

Input
4
1 3 5 7
4
7 5 3 1

Output
1 1



-----Note-----

In the first example, we can choose $20$ from array $[20]$ and $20$ from array $[10, 20]$. Number $40 = 20 + 20$ doesn't belong to any of those arrays. However, it is possible to choose $10$ from the second array too.

In the second example, we can choose $3$ from array $[3, 2, 2]$ and $1$ from array $[1, 5, 7, 7, 9]$. Number $4 = 3 + 1$ doesn't belong to any of those arrays.

In the third example, we can choose $1$ from array $[1, 3, 5, 7]$ and $1$ from array $[7, 5, 3, 1]$. Number $2 = 1 + 1$ doesn't belong to any of those arrays.

Difficulty: EASY

Solutions:
n = int(input())
arr1 = [int(i) for i in input().split()]
k = int(input())
arr2 = [int(i) for i in input().split()]
print(max(arr1), max(arr2))


n = input()
arr = list(map(int, input().split()))
m = input()
brr = list(map(int, input().split()))
arr.sort()
brr.sort()
print(arr[-1], brr[-1])


import sys
input = lambda : sys.stdin.readline().strip()
n = int(input())
m1 = max(list(map(int, input().split())))
n = int(input())
m2 = max(list(map(int, input().split())))
print(m1, m2)


input()
A = max(map(int, input().split()))
input()
B = max(map(int, input().split()))
print(A, B)


num1 = int(input())
li_1 = input()
list_1 = []
lists_1 = li_1.split()
for i in range(num1):
	list_1.append(int(lists_1[i]))
num2 = int(input())
li_2 = input()
list_2 = []
lists_2 = li_2.split()
for i in range(num2):
	list_2.append(int(lists_2[i]))
list_1.sort()
list_2.sort()
print(list_1[num1 - 1], list_2[num2 - 1])


n = int(input())
a = list(map(int, input().strip().split()))
m = int(input())
b = list(map(int, input().strip().split()))
c = max(a)
d = max(b)
print(c, d, sep=' ')


_ = input()
a = max(map(int, input().split()))
_ = input()
b = max(map(int, input().split()))
print(a, b)


n = int(input())
o = list(map(int, input().split()))
m = int(input())
p = list(map(int, input().split()))
print(max(o), max(p))


n = int(input())
a = max(map(int, input().split()))
m = int(input())
b = max(map(int, input().split()))
print(a, b)


n = int(input())
x = list(map(int, input().split()))
m = int(input())
y = list(map(int, input().split()))
print(max(x), max(y))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
mxOne = a[0]
mxTwo = b[0]
for i in range(1, n):
	mxOne = max(mxOne, a[i])
for i in range(1, m):
	mxTwo = max(mxTwo, b[i])
print(mxOne, mxTwo)


i = lambda : max(map(int, input().split()))
print(i() * 0 + i(), i() * 0 + i())


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
print('{} {}'.format(a[0], b[0]))


n = int(input())
A = [int(x) for x in input().split()]
m = int(input())
B = [int(x) for x in input().split()]
max1 = max(A)
max2 = max(B)
print(max1, max2)


n = int(input())
a = map(int, input().split())
m = int(input())
b = map(int, input().split())
p = -1
q = -1
for i in a:
	if i > p:
		p = i
for i in b:
	if i > q:
		q = i
print(f'{p} {q}')


n1 = int(input())
l1 = map(int, input().split(' '))
n2 = int(input())
l2 = map(int, input().split(' '))
m = l1.__next__()
n = l2.__next__()
for i in l1:
	if m < i:
		m = i
for j in l2:
	if n < j:
		n = j
print(m, n)


exec("input()\nprint(max(map(int,input().split())),end=' ')\n" * 2)


n = int(input())
arr = list(map(int, input().split()))
m = int(input())
arr2 = list(map(int, input().split()))
print(max(arr), max(arr2))


input()
a = [int(i) for i in input().split()]
input()
b = [int(i) for i in input().split()]
print(max(a), max(b))


n = int(input())
a = map(int, input().split())
m = int(input())
b = map(int, input().split())
A = list(a)
B = list(b)
print(max(A), max(B))


n = int(input())
a = [int(i) for i in input().split()]
a = max(a)
m = int(input())
b = [int(j) for j in input().split()]
b = max(b)
print(str(a) + ' ' + str(b))


import os
import sys
from io import BytesIO, IOBase
import math
from decimal import Decimal
from decimal import *
from collections import defaultdict, deque
import heapq
from decimal import Decimal
getcontext().prec = 25
abcd = 'abcdefghijklmnopqrstuvwxyz'
MOD = 1000000007
BUFSIZE = 8192
from bisect import bisect_left, bisect_right

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
l1 = list(map(int, input().split(' ')))
m = int(input())
l2 = list(map(int, input().split(' ')))
print(max(l1), max(l2))


a = int(input())
A = input() + ' '
b = int(input())
B = input() + ' '
maxA = 0
maxB = 0
str_num = ''
for letter in A:
	if letter != ' ':
		str_num = str_num + letter
	else:
		if int(str_num) >= maxA:
			maxA = int(str_num)
		str_num = ''
str_num = ''
for letter in B:
	if letter != ' ':
		str_num = str_num + letter
	else:
		if int(str_num) >= maxB:
			maxB = int(str_num)
		str_num = ''
print(str(maxA) + ' ' + str(maxB))


n = int(input())
A = [*map(int, input().split())]
m = int(input())
B = [*map(int, input().split())]
A.sort()
B.sort()
print(A[-1], B[-1])


n = int(input())
a = sorted([int(x) for x in input().split()])
m = int(input())
b = sorted([int(x) for x in input().split()])
print(a[-1], b[-1])


from sys import stdin
_input = stdin.readline
(_max, _int) = (max, int)

def solution():
	a = _int(_input())
	arr = _max([_int(i) for i in _input().split()])
	b = _int(_input())
	arr_b = _max([_int(i) for i in _input().split()])
	print(arr, arr_b)
solution()


num1 = int(input())
arr1 = list(map(int, input().split()))
num2 = int(input())
arr2 = list(map(int, input().split()))
max1 = max(arr1)
max2 = max(arr2)
print(str(max1) + ' ' + str(max2))


for x in range(2):
	a = int(input())
	b = list(map(int, input().split()))
	print(max(b), end=' ')


def main():
	n = int(input())
	a = [int(x) for x in input().split()]
	m = int(input())
	b = [int(x) for x in input().split()]
	a.sort()
	b.sort()
	print(str(a[n - 1]) + ' ' + str(b[m - 1]))
main()


a = int(input())
l = list(map(int, input().split()))
b = int(input())
m = list(map(int, input().split()))
l.sort()
m.sort()
print(l[-1], m[-1])


n = int(input())
a = [int(i) for i in input().split()]
m = int(input())
b = [int(i) for i in input().split()]
ma = 0
mb = 0
for i in a:
	ma = max(ma, i)
for i in b:
	mb = max(mb, i)
print(ma, mb)


n = int(input())
a = [int(i) for i in input().split(' ')]
n = int(input())
b = [int(i) for i in input().split(' ')]
print(sorted(a)[-1], sorted(b)[-1])


input()
a = sorted(list(map(int, input().split())))
input()
b = sorted(list(map(int, input().split())))
print(a[-1], b[-1])


a = int(input())
l1 = list(map(int, input().split()))
b = int(input())
l2 = list(map(int, input().split()))
l1.sort()
l2.sort()
print(l1[a - 1], l2[b - 1])


ar_count = int(input())
ar = list(map(int, input().rstrip().split()))
ar_count2 = int(input())
ar2 = list(map(int, input().rstrip().split()))
print(max(ar), max(ar2))


num1 = int(input())
arr1 = list(map(int, input().split()))
num2 = int(input())
arr2 = list(map(int, input().split()))
arr1.sort()
arr2.sort()
print(arr1[num1 - 1], end=' ')
print(arr2[num2 - 1])


n = input()
a = list(map(int, input().rstrip().split()))
r = input()
b = list(map(int, input().rstrip().split()))
print(max(a), max(b))


n = int(input())
a1 = []
s = input().split()
for i in s:
	a1.append(int(i))
m = int(input())
a2 = []
s = input().split()
for i in s:
	a2.append(int(i))
print(max(a1), max(a2))


n = int(input())
arr1 = list(map(int, input().split()))
n = int(input())
arr2 = list(map(int, input().split()))
print(max(arr1), end=' ')
print(max(arr2))


from collections import defaultdict
n = int(input())
a = [int(x) for x in input().split()]
m = int(input())
b = [int(x) for x in input().split()]
print(max(a), max(b))


n = int(input())
max1 = 0
max2 = 0
for i in map(int, input().split()):
	if i > max1:
		max1 = i
m = int(input())
for i in map(int, input().split()):
	if i > max2:
		max2 = i
print(max1, max2)


nA = int(input())
A = list((int(x) for x in list(str(input()).split(' '))))
nB = int(input())
B = list((int(x) for x in list(str(input()).split(' '))))
print(max(A), max(B))


from sys import stdin
a = stdin.readline()
A = sorted((int(i) for i in stdin.readline().split()))
b = stdin.readline()
B = sorted((int(i) for i in stdin.readline().split()))
print(A[-1], B[-1])


t = int(input())
b = sorted(list(map(int, input().split())))
n = int(input())
c = sorted(list(map(int, input().split())))
print(b[-1], c[-1])


import sys
import re
from collections import deque, Counter, OrderedDict, defaultdict
from heapq import nsmallest, nlargest, heapify, heappop, heappush, heapreplace
from bisect import bisect_left, bisect_right

def dfs(curr, parent):
	visited[curr] = True
	value[curr] += value[parent]
	for i in mydict[curr]:
		if not visited[i]:
			dfs(i, curr)

def get_array():
	return list(map(int, sys.stdin.readline().strip().split()))

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

def input():
	return sys.stdin.readline().strip()
n = int(input())
A = get_array()
A.sort()
m = int(input())
B = get_array()
B.sort()
print(A[-1], B[-1])


from sys import stdin
from math import gcd, sqrt, log10, log2

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())
n = ii()
a = li()
m = ii()
b = li()
print(max(a), max(b))


n = int(input())
a = list((int(i) for i in input().split()))
m = int(input())
b = list((int(i) for i in input().split()))
a.sort()
b.sort()
print(a[n - 1], b[m - 1])


n = int(input())
A = input().split()
m = int(input())
B = input().split()
for i in range(n):
	A[i] = int(A[i])
for i in range(m):
	B[i] = int(B[i])
A.sort()
B.sort()
print(int(A[n - 1]), int(B[m - 1]))


n = input()
a = [int(x) for x in input().split()]
m = input()
b = [int(x) for x in input().split()]
print(max(a), max(b))


for _ in range(1):
	x = int(input())
	arr = list(map(int, input().strip().split()))
	y = int(input())
	brr = list(map(int, input().strip().split()))
	arr.sort()
	brr.sort()
	print(arr[x - 1], brr[y - 1])


n = int(input())
Listn = list(map(int, input().split()))
m = int(input())
Listm = list(map(int, input().split()))
print(max(Listn), max(Listm))


number = int(input())
A = list(map(int, input().split()))
number2 = int(input())
B = list(map(int, input().split()))
A.sort()
B.sort()
print(A[-1], B[-1])


n = int(input())
a = [int(w) for w in input().split()]
m = int(input())
b = [int(w) for w in input().split()]
a.sort()
b.sort()
x = a[n - 1]
y = b[m - 1]
print(x, y)


_ = int(input())
arr1 = [int(num) for num in input().split()]
_ = int(input())
arr2 = [int(num) for num in input().split()]
print(max(arr1), max(arr2))


n = int(input())
a = input()
n2 = int(input())
b = input()
a = [int(x) for x in a.split()]
a = sorted(a)
A = a[-1]
b = [int(x) for x in b.split()]
b = sorted(b)
B = b[-1]
print(A, B)


a = int(input())
A = list(map(int, input().split()))
b = int(input())
B = list(map(int, input().split()))
A.sort()
B.sort()
print(A[a - 1], B[b - 1])


n = int(input())
ln = list(map(int, input().split()))
m = int(input())
lm = list(map(int, input().split()))
print(max(ln), max(lm))


a = int(input())
b = input().split()
maxb = 0
for i in range(a):
	if int(b[i]) > maxb:
		maxb = int(b[i])
c = int(input())
v = input().split()
maxv = 0
for i in range(c):
	if int(v[i]) > maxv:
		maxv = int(v[i])
print(maxb, maxv)


import math
I = lambda : int(input())
ID = lambda : map(int, input().split())
IL = lambda : list(ID())
n = I()
a = IL()
m = I()
b = IL()
print(max(a), max(b))


import itertools

def input_ints():
	return list(map(int, input().split()))

def output_list(v):
	print(' '.join((str(x) for x in v)))

def main():
	input()
	a = input_ints()
	input()
	b = input_ints()
	print(max(a), max(b))
main()


def find_pair(a, b):
	return (max(a), max(b))
n = int(input())
a = list(map(int, input().strip().split()))
m = int(input())
b = list(map(int, input().strip().split()))
print(*find_pair(a, b))


a = int(input())
b = list(map(int, input().split()))
e = int(input())
c = list(map(int, input().split()))
d = max(b)
f = max(c)
print(d, f)


n = int(input())
l1 = input().split()
li1 = [int(i) for i in l1]
m = int(input())
l2 = input().split()
li2 = [int(i) for i in l2]
print(max(li1), max(li2))


na = int(input())
A = list(map(int, input().split(' ')))
nb = int(input())
B = list(map(int, input().split(' ')))
print(max(A), max(B))


n = int(input())
a = list(map(int, input().split()))
c = int(input())
m = list(map(int, input().split()))
a.sort()
m.sort()
print(a[n - 1], m[c - 1])


n = int(input())
z = max(list(map(int, input().split())))
m = int(input())
x = max(list(map(int, input().split())))
print(z, x, end='')


n = int(input())
a = [int(num) for num in input().split()]
m = int(input())
b = [int(num) for num in input().split()]
print(max(a), max(b))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
(first, last) = (max(a), max(b))
print(first, last)


n = int(input())
p = list(map(int, input().split()))
m = int(input())
q = list(map(int, input().split()))
print(max(p), max(q))


from sys import stdin
n = int(stdin.readline().rstrip())
a = list(map(int, stdin.readline().split()))
m = int(stdin.readline().rstrip())
b = list(map(int, stdin.readline().split()))
print(str(max(a)) + ' ' + str(max(b)))


n = int(input())
l = list(map(int, input().split()))
m = int(input())
s = list(map(int, input().split()))
l.sort()
s.sort()
print(l[-1], s[-1])


def main():
	_ = input()
	a = max(list(map(int, input().split())))
	_ = input()
	b = max(list(map(int, input().split())))
	print(a, b)
main()


a = input()
la = map(int, input().split())
b = input()
lb = map(int, input().split())
print(max(la), max(lb))


_ = int(input())
A = list(map(int, input().split()))
_ = int(input())
B = list(map(int, input().split()))
print(str(max(A)) + ' ' + str(max(B)))


N = int(input())
A = sorted(list(map(int, input().split())))
M = int(input())
B = sorted(list(map(int, input().split())))
print(A[-1], B[-1])


m = int(input())
l = list(map(int, input().split()))
n = int(input())
l1 = list(map(int, input().split()))
print(max(l), max(l1))


n = int(input())
a = []
a = list(map(int, input().strip().split()))[:n]
m = int(input())
b = list(map(int, input().strip().split()))[:m]
print(max(a), max(b))


n = int(input())
aa = input()
a = [int(i) for i in aa.split()]
m = int(input())
bb = input()
b = [int(i) for i in bb.split()]
m1 = max(a)
m2 = max(b)
print('{} {}'.format(m1, m2))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
a.sort()
b.sort()
c1 = a[n - 1]
c2 = b[m - 1]
print(c1, c2)


input()
a = list(map(int, input().split()))
input()
b = list(map(int, input().split()))
print(max(a), max(b))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
a.sort()
b.sort()
print(a[len(a) - 1], b[len(b) - 1])


A = input()
B = input()
listC = B.split()
D = input()
E = input()
listD = E.split()
rA = []
rB = []
for i in range(len(listC)):
	rA.append(int(listC[i]))
for i in range(len(listD)):
	rB.append(int(listD[i]))
print(max(rA), max(rB))


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	I()
	l1 = LI()
	I()
	l2 = LI()
	l1.sort()
	l2.sort()
	return str(l1[-1]) + ' ' + str(l2[-1])
print(main())


n = int(input())
arr = list(map(int, input().split()))
m = int(input())
arr1 = list(map(int, input().split()))
x = max(arr)
y = max(arr1)
print(f'{x} {y}')


n = int(input())
a = input().split()
m = int(input())
b = input().split()
ma = 0
mb = 0
for i in range(0, max(n, m)):
	if i < n:
		if int(a[i]) > ma:
			ma = int(a[i])
	if i < m:
		if int(b[i]) > mb:
			mb = int(b[i])
print(ma, end=' ')
print(mb)


amax = 0
bmax = 0
a = int(input())
A = input().split()
for i in range(a):
	A[i] = int(A[i])
	if A[i] >= amax:
		amax = A[i]
b = int(input())
B = input().split()
for i in range(b):
	B[i] = int(B[i])
	if B[i] >= bmax:
		bmax = B[i]
print(amax, bmax)


a = int(input())
arr = list(map(int, input().split()))
b = int(input())
brr = list(map(int, input().split()))
print(max(arr), max(brr))


n = int(input())
A = list(map(int, input().split(' ')))
m = int(input())
B = list(map(int, input().split(' ')))
print(max(A), max(B))


a = []
b = []
n = int(input())
i = input()
a = i.split()
for r in range(len(a)):
	a[r] = int(a[r])
m = int(input())
j = input()
b = j.split()
for l in range(len(b)):
	b[l] = int(b[l])
a.sort()
b.sort()
print(a[n - 1], b[m - 1])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
print(max(a), max(list(map(int, input().split()))))


import sys, math, queue
MOD = 998244353
sys.setrecursionlimit(1000000)
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
print(max(a), max(b))


n = int(input())
l1 = list(map(int, input().split()))
m = int(input())
l2 = list(map(int, input().split()))
m1 = max(l1)
m2 = max(l2)
if m1 + m2 not in l1 or l2:
	print(m1, m2)


ara1 = []
ara2 = []
n1 = int(input())
ss = input()
for i in ss.split():
	ara1.append(int(i))
n1 = int(input())
ss2 = input()
for i in ss2.split():
	ara2.append(int(i))
print(f'{max(ara1)} {max(ara2)}')


n1 = int(input())
A = list(map(int, input().split(' ')))
n2 = int(input())
B = list(map(int, input().split(' ')))
A.sort()
B.sort()
print(A[-1], B[-1])


def insertionSort(arr):
	for i in range(1, len(arr)):
		key = arr[i]
		j = i - 1
		while j >= 0 and key < arr[j]:
			arr[j + 1] = arr[j]
			j -= 1
		arr[j + 1] = key
a = []
b = []
x = input()
y = input()
o = input()
l = input()
arrayA = y.split(' ')
for i in range(len(arrayA)):
	a.append(int(arrayA[i]))
insertionSort(a)
if len(arrayA) != int(x):
	print('wrong input')
arrayB = l.split(' ')
for i in range(len(arrayB)):
	b.append(int(arrayB[i]))
insertionSort(b)
if len(arrayB) != int(o):
	print('wrong input')
print(a[-1], b[-1])


a = int(input())
arr = list(map(int, input().split()))
b = int(input())
arr1 = list(map(int, input().split()))
arr.sort()
arr1.sort()
print(arr[-1], arr1[-1])


n = int(input())
ln = list(map(int, input().split()))
m = int(input())
lm = list(map(int, input().split()))
ln.sort()
lm.sort()
print(f'{ln[len(ln) - 1]} {lm[len(lm) - 1]}')


from sys import stdin

def read_ints():
	return list(map(int, stdin.readline().split()))
stdin.readline()
a = read_ints()
stdin.readline()
b = read_ints()
a_max = max(a)
b_max = max(b)
print(a_max, b_max)


A = int(input())
alist = list(map(int, input().split()))
B = int(input())
blist = list(map(int, input().split()))
print(max(alist), max(blist))


def run(a, b):
	max_a = max(a)
	max_b = max(b)
	print(max_a, max_b)
input()
a = list(map(int, input().split()))
input()
b = list(map(int, input().split()))
run(a, b)


n = int(input())
A = [int(s) for s in input().split(' ')]
m = int(input())
B = [int(s) for s in input().split(' ')]
a = max(A)
b = max(B)
print(a, b)


n1 = int(input())
l1 = list(map(int, input().split()))
n2 = int(input())
l2 = list(map(int, input().split()))
print(max(l1), max(l2))


N = int(input())
L = list(map(int, input().split()))
M = int(input())
L2 = list(map(int, input().split()))
(L.sort(), L2.sort())
print(L[N - 1], L2[M - 1])


n = int(input())
a = list(map(int, input().split()))
n1 = int(input())
b = list(map(int, input().split()))
print(max(a), max(b))


n = int(input())
a = [int(item) for item in input().split()]
m = int(input())
b = [int(item) for item in input().split()]
a.sort()
b.sort()
print(a[-1], b[-1])


n = int(input())
arr = [int(i) for i in input().split()]
m = int(input())
brr = [int(i) for i in input().split()]
a = max(arr)
b = max(brr)
print(a, b, sep=' ')


inp1 = input()
inpa1 = map(int, input().split())
inp2 = input()
inpa2 = map(int, input().split())
print(max(inpa1), max(inpa2))


input()
max1 = max([int(i) for i in input().split()])
input()
max2 = max([int(i) for i in input().split()])
print(max1, max2)


x = input()
A = input()
setA = A.split()
y = input()
B = input()
setB = B.split()
a = list(map(int, setA))
b = list(map(int, setB))
a.sort(reverse=True)
b.sort(reverse=True)
p = []
p.append(a[0])
p.append(b[0])
print(*p)


input()
a = [int(x) for x in input().split()]
input()
b = [int(x) for x in input().split()]
print(sorted(a)[-1], sorted(b)[-1])


na = int(input())
a = [int(i) for i in input().split()]
nb = int(input())
b = [int(i) for i in input().split()]
print(max(a), max(b))


n = int(input())
c = list(map(int, input().split()))
m = int(input())
d = list(map(int, input().split()))
print(max(c), max(d))


n = int(input())
a = list(map(int, input().split(' ')))
m = int(input())
b = list(map(int, input().split(' ')))
from math import *
a.sort()
b.sort()
print(a[n - 1], b[m - 1])


I = input
M = lambda : max(map(int, I().split()))
I()
a = M()
I()
print(a, M())


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
print(max(a), end=' ')
print(max(b))


n = int(input())
dat = list(map(int, input().split()))
dat.sort()
x = dat[-1]
n = int(input())
dat = list(map(int, input().split()))
dat.sort()
y = dat[-1]
print(x, y)


def findMax(L, l=0, h=0):
	if h == 0:
		h = len(L) - 1
	index = 0
	largest = 0
	for i in range(l, h + 1):
		if L[i] > largest:
			largest = L[i]
			index = i
	return (largest, index)
n = int(input())
L1 = [int(x) for x in input().split()]
m = int(input())
L2 = [int(x) for x in input().split()]
max1 = findMax(L1)[0]
max2 = findMax(L2)[0]
print(str(max1) + ' ' + str(max2))


N = int(input())
A = list(map(int, input().split()))
M = int(input())
B = list(map(int, input().split()))
print(max(A), max(B), sep=' ')


from math import *
from itertools import *
from collections import *
from bisect import *
input()
A = [int(x) for x in input().split()]
input()
B = [int(x) for x in input().split()]
print(max(A), max(B))


import math
n = int(input())
ll = list(map(int, input().split()))
m = int(input())
pp = list(map(int, input().split()))
l = sorted(ll, reverse=True)
p = sorted(pp, reverse=True)
print(l[0], p[0])


elementsInA = int(input())
Aelement = input().split()
listOfA = [int(x) for x in Aelement]
elementsInB = int(input())
Belement = input().split()
listOfB = [int(x) for x in Belement]
listOfB.sort()
listOfA.sort()
print(listOfA[-1], listOfB[-1])


n = int(input())
arr1 = list(map(int, input().split()))
m = int(input())
arr2 = list(map(int, input().split()))
arr1.sort()
arr2.sort()
print(arr1[-1], arr2[-1])


q1 = int(input())
arr1 = sorted(list(map(int, input().split())))
q2 = int(input())
arr2 = sorted(list(map(int, input().split())))
print(arr1[q1 - 1], arr2[q2 - 1])


n1 = int(input())
a = list(map(int, input().split()))
n2 = int(input())
b = list(map(int, input().split()))
print(f'{max(a)} {max(b)}')


num_n = int(input())
input_a = input()
array_a = input_a.split(' ')
num_m = int(input())
input_b = input()
array_b = input_b.split(' ')
int_array_a = []
for i in array_a:
	int_array_a.append(int(i))
int_array_b = []
for i in array_b:
	int_array_b.append(int(i))
int_array_a = sorted(int_array_a)
int_array_b = sorted(int_array_b)
print(int_array_a[-1], int_array_b[-1])


t = 1
while t:
	t -= 1
	n = int(input())
	a = list(map(int, input().split()))
	m = int(input())
	b = list(map(int, input().split()))
	print(max(a), max(b))


n = int(input())
tab = list(map(int, input().split()))
m = int(input())
sec = list(map(int, input().split()))
tab.sort()
sec.sort()
print(tab[-1], sec[-1])


import sys
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def main():
	n = int(input())
	a = get_array()
	m = int(input())
	b = get_array()
	a.sort()
	b.sort()
	print(a[-1], b[-1])
main()


t = int(input())
x = [int(q) for q in input().split()]
t1 = int(input())
y = [int(w) for w in input().split()]
print(max(x), max(y))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
c = 0
d = 0
for i in range(n):
	if a[i] > c:
		c = a[i]
for i in range(m):
	if b[i] > d:
		d = b[i]
print(c, d)


n1 = int(input())
a = list(map(int, input().strip().split(' ')))
n2 = int(input())
a1 = list(map(int, input().strip().split(' ')))
a.sort()
a1.sort()
print(a[n1 - 1], a1[n2 - 1])


n = int(input())
li1 = list(map(int, input().split()))
m = int(input())
li2 = list(map(int, input().split()))
print(max(li1), max(li2))


a = int(input())
a_items = input().split(' ')
a_items = [int(a_items[i]) for i in range(a)]
a_items.sort()
b = int(input())
b_items = input().split(' ')
b_items = [int(b_items[i]) for i in range(b)]
b_items.sort()
print(a_items[-1], b_items[-1])


from sys import stdin, stdout
x = stdin.read().split('\n')
a = map(int, x[1].split(' '))
b = map(int, x[3].split(' '))
print(max(a), max(b))


from collections import Counter
import math

def solve():
	a = int(input())
	A = [int(i) for i in input().split()]
	b = int(input())
	B = [int(i) for i in input().split()]
	return (max(A), max(B))
val = solve()
print(val[0], val[1])


n = int(input())
fst = list(map(int, input().split()))
m = int(input())
snd = list(map(int, input().split()))
fst.sort()
snd.sort()
print(fst[n - 1], snd[m - 1], sep=' ')


def print_pair(a, b):
	print(str(max(a)) + ' ' + str(max(b)))
n1 = int(input())
a = list(map(int, input().split()))
n2 = int(input())
b = list(map(int, input().split()))
print_pair(a, b)


a = int(input())
l1 = list(map(int, input().split()))
b = int(input())
l2 = list(map(int, input().split()))
print(max(l1), max(l2))


def choose2num():
	inp1 = int(input())
	global inpa1
	if 1 <= inp1 <= 100:
		inpa1 = map(int, input().split())
	inp2 = int(input())
	global inpa2
	if 1 <= inp2 <= 100:
		inpa2 = map(int, input().split())
	print(max(inpa1), max(inpa2))
choose2num()


I = lambda : max(map(int, input() and input().split()))
print(I(), I())


a = int(input())
c = list(map(int, input().split()))
b = int(input())
d = list(map(int, input().split()))
print(max(c), max(d))


n = int(input())
A = list(map(int, input().split()))
m = int(input())
B = list(map(int, input().split()))
biggest1 = 0
for i in range(n):
	if biggest1 < A[i]:
		biggest1 = A[i]
biggest2 = 0
for i in range(m):
	if biggest2 < B[i]:
		biggest2 = B[i]
print(biggest1, biggest2)


n = int(input())
x = list(map(int, input().split()))
m = int(input())
y = list(map(int, input().split()))
a = max(x)
b = max(y)
print(a, b)


sizeA = int(input())
A = input().strip().split(' ')
A = list(map(lambda x: int(x), A))
A.sort()
sizeB = int(input())
B = input().strip().split(' ')
B = list(map(lambda x: int(x), B))
B.sort()
print('{} {}'.format(A[sizeA - 1], B[sizeB - 1]))


def int_multiple():
	return [int(c) for c in input().split()]

def int_single():
	return int(input())

def str_multiple():
	return [c for c in input().split()]

def str_single():
	return input()
n = int_single()
a = int_multiple()
m = int_single()
b = int_multiple()
s = ''
s += str(max(a)) + ' '
s += str(max(b))
print(s)


n = int(input())
A = [int(i) for i in input().split()]
m = int(input())
B = [int(i) for i in input().split()]
print(max(A), max(B))


import os
import sys
from io import BytesIO, IOBase

def solution(arr, brr, n, m):
	write(max(arr), max(brr))

def main():
	n = r_int()
	arr = r_array()
	m = r_int()
	brr = r_array()
	solution(arr, brr, n, m)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def write(*args, end='\n'):
	for x in args:
		sys.stdout.write(str(x) + ' ')
	sys.stdout.write(end)

def r_array():
	return [int(x) for x in input().split()]

def r_int():
	return int(input())

def w_array(arr):
	for x in arr:
		write(x, end=' ')
	write()
main()


import os

def f(a_arr, b_arr):
	return f'{max(a_arr)} {max(b_arr)}'
if os.environ.get('DEBUG', False):
	print(f'{f([20], [10, 20])} = 20 20')
	print(f'{f([3, 2, 2], [1, 5, 7, 7, 9])} = 3 1')
	print(f'{f([1, 3, 5, 7], [7, 5, 3, 1])} = 1 1')
else:
	n = int(input())
	a_arr = list(map(int, input().split()))
	m = int(input())
	b_arr = list(map(int, input().split()))
	print(f(a_arr, b_arr))


print(*(max(map(int, input() and input().split())) for _ in '12'))


input()
print(sorted(map(int, input().split()))[-1], end=' ')
input()
print(sorted(map(int, input().split()))[-1])


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
print(max(a), max(b))


n = int(input())
A = list(map(int, input().split()))
m = int(input())
B = list(map(int, input().split()))
A.sort()
B.sort()
print(A[len(A) - 1], B[len(B) - 1])


from sys import stdin
inp = lambda : stdin.readline().strip()
n = int(inp())
a = [int(x) for x in inp().split()]
a.sort()
n = int(inp())
b = [int(x) for x in inp().split()]
b.sort()
print(a[-1], b[-1])


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
mod2 = 998244353
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def IF(c, t, f):
	return t if c else f

def main():
	t = 1
	rr = []
	for _ in range(t):
		n = I()
		a = LI()
		m = I()
		b = LI()
		rr.append(JA([max(a), max(b)], ' '))
	return JA(rr, '\n')
print(main())


n = int(input())
arr1 = map(int, input().split())
m = int(input())
arr2 = map(int, input().split())
c = max(arr1)
d = max(arr2)
print(c, d)


t = int(input())
A = list(map(int, input().split()))
v = int(input())
B = list(map(int, input().split()))
print(max(A), max(B))


num_A = int(input())
array_A = input().split()
array_A = [int(x) for x in array_A]
num_B = int(input())
array_B = input().split()
array_B = [int(x) for x in array_B]
array_A.sort()
array_B.sort()
max_A = max(array_A)
max_B = max(array_B)
print(max_A, max_B)


def insertionSort(arr):
	for i in range(1, len(arr)):
		key = arr[i]
		j = i - 1
		while j >= 0 and key < arr[j]:
			arr[j + 1] = arr[j]
			j -= 1
		arr[j + 1] = key

def strToInt(arr):
	n = len(arr)
	for i in range(n):
		arr[i] = int(arr[i])
lengthA = int(input())
elementA = input()
elementA = elementA.split()
strToInt(elementA)
insertionSort(elementA)
lengthB = int(input())
elementB = input()
elementB = elementB.split()
strToInt(elementB)
insertionSort(elementB)
print(str(elementA[lengthA - 1]) + ' ' + str(elementB[lengthB - 1]))


n = int(input())
l = list(map(int, input().split()))
m = int(input())
s = list(map(int, input().split()))
print(max(l), max(s))


n = int(input())
A = list(map(int, input().split(' ')))
m = int(input())
B = list(map(int, input().split(' ')))
x = str(max(A))
y = str(max(B))
print(x + ' ' + y)


a = int(input())
arrayA = [int(x) for x in input().split()]
b = int(input())
arrayB = [int(x) for x in input().split()]
arrayA.sort()
arrayB.sort()
print(str(arrayA[len(arrayA) - 1]) + ' ' + str(arrayB[len(arrayB) - 1]))


q = int(input())
w = list(map(int, input().split()))
e = input()
r = list(map(int, input().split()))
print(max(w), max(r))


MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
n = int(input())
a = I()
(m,) = I()
b = I()
a.sort()
b.sort()
print(a[-1], b[-1])


import sys
input = sys.stdin.buffer.readline
from collections import defaultdict

def getlist():
	return list(map(int, input().split()))

def main():
	N = int(input())
	A = getlist()
	M = int(input())
	B = getlist()
	A = sorted(A)
	B = sorted(B)
	print(A[-1], B[-1])
main()


t = int(input())
b = list(map(int, input().split()))
n = int(input())
c = list(map(int, input().split()))
b.sort()
c.sort()
print(b[-1], c[-1])


n = int(input())
A = list(map(int, input().split()))
m = int(input())
B = list(map(int, input().split()))
Ai = max(A)
Bi = max(B)
result1 = Ai + Bi
print(Ai, Bi)


def choosetwonumbers(A, B):
	i = max(A)
	j = max(B)
	return [i, j]
k = input()
A = list(map(int, input().split()))
t = input()
B = list(map(int, input().split()))
separator = ' '
list = choosetwonumbers(A, B)
print(separator.join(map(str, list)))


SizeA = input()
temp = input()
A = []
B = []
for element in temp.split():
	A.append(int(element))
SizeB = input()
temp = input()
for element in temp.split():
	B.append(int(element))
A.sort()
B.sort()
print(A[-1], B[-1])


n = int(input())
lst = list(map(int, input().split()))
m = int(input())
lst2 = list(map(int, input().split()))
lst.sort()
lst2.sort()
print(lst[-1], lst2[-1])


a = int(input())
b = list(map(int, input().split()))
c = int(input())
d = list(map(int, input().split()))
b.sort()
d.sort()
print(b[a - 1], d[c - 1])


import sys
import math
from collections import defaultdict
strInp = lambda : input().strip().split()
intInp = lambda : list(map(int, strInp()))
n = int(input())
a = intInp()
m = int(input())
b = intInp()
print(max(a), max(b))


n = int(input())
A = [int(x) for x in input().split()]
m = int(input())
B = [int(x) for x in input().split()]
sortA = sorted(A)
sortB = sorted(B)
print(sortA[-1], sortB[-1])


na = int(input())
a = list(map(int, input().split()))
nb = int(input())
b = list(map(int, input().split()))
print(max(a), max(b))


from sys import stdin, stdout
input = stdin.readline
t = 1
for _ in range(t):
	n = int(input())
	a = [int(x) for x in input().split()]
	m = int(input())
	b = [int(x) for x in input().split()]
	print(max(a), max(b))


Asize = input()
Anum = input()
listA = Anum.split()
Bsize = input()
Bnum = input()
listB = Bnum.split()
realA = []
realB = []
for i in range(len(listA)):
	realA.append(int(listA[i]))
for i in range(len(listB)):
	realB.append(int(listB[i]))
print(max(realA), max(realB))


n = input()
l = list(map(int, input().split()))
l.sort()
n = input()
ll = list(map(int, input().split()))
ll.sort()
print(l[-1], ll[-1])


n = int(input())
k = list(map(int, input().split()))
m = int(input())
l = list(map(int, input().split()))
print(max(k), max(l))


def calc():
	print()

def main():
	n: int = int(input())
	A: list = list(map(int, input().split()))
	m: int = int(input())
	B: list = list(map(int, input().split()))
	A.sort()
	B.sort()
	print(A.pop(), B.pop())
main()


n = int(input())
p = set(map(int, input().split()))
m = int(input())
q = set(map(int, input().split()))
p = sorted(p)
q = sorted(q)
print(p[-1], q[-1])


n = int(input())
first_list = list(map(int, input().split()))
m = int(input())
second_list = list(map(int, input().split()))
first_list.sort(reverse=True)
second_list.sort(reverse=True)
print(str(first_list[0]) + ' ' + str(second_list[0]))


input()
x = max(map(int, input().split()))
input()
y = max(map(int, input().split()))
print(x, y)


n1 = int(input())
l1 = list(map(int, input().split()))
n2 = int(input())
l2 = list(map(int, input().split()))
l1.sort(reverse=True)
l2.sort(reverse=True)
print(l1[0], l2[0])


n = int(input())
a = list(set(map(int, input().split())))
m = int(input())
b = list(set(map(int, input().split())))
print(max(a), max(b))


input()
xs = map(int, input().split())
input()
ys = map(int, input().split())
mx = max(xs)
my = max(ys)
print(mx, my)


n1 = int(input())
a = list(map(int, input().split()))
n2 = int(input())
b = list(map(int, input().split()))

def f(A, B):
	temp1 = max(A)
	temp2 = max(B)
	print(temp1, temp2)
f(a, b)


n = int(input())
a = list(map(int, input().split()))
x = max(a)
n = int(input())
a = list(map(int, input().split()))
y = max(a)
print(x, y)


n = int(input())
a = [int(ele) for ele in input().split()]
m = int(input())
b = [int(ele) for ele in input().split()]
max1 = max(a)
max2 = max(b)
print(max1, max2)


from sys import stdin
import heapq

def find_max(n, m, arr):
	pque = [0] * len(arr)
	for i in range(len(arr)):
		pque[i] = -arr[i]
	heapq.heapify(pque)
	ans = 0
	while n > 0:
		cur_max = -heapq.heappop(pque)
		ans += cur_max
		cur_max -= 1
		if cur_max > 0:
			heapq.heappush(pque, -cur_max)
		n -= 1
	return ans

def find_min(n, m, arr):
	pque = arr[:]
	heapq.heapify(pque)
	ans = 0
	while n > 0:
		cur_min = heapq.heappop(pque)
		ans += cur_min
		cur_min -= 1
		if cur_min > 0:
			heapq.heappush(pque, cur_min)
		n -= 1
	return ans

def solution(n, m, arr):
	mn = find_min(n, m, arr)
	mx = find_max(n, m, arr)
	return [mx, mn]
n = int(stdin.readline().strip())
arr = list(map(int, stdin.readline().split()))
m = int(stdin.readline().strip())
barr = list(map(int, stdin.readline().split()))
arr.sort()
barr.sort()
print(arr[-1], barr[-1])


a = int(input())
A = [int(i) for i in input().split()]
b = int(input())
B = [int(i) for i in input().split()]
print(max(A), max(B))


n = int(input())
(l1, l2) = ([], [])
(a, b) = (0, 0)
l1 = [int(z) for z in input().split()]
for i in l1:
	a = max(a, i)
m = int(input())
l2 = [int(z) for z in input().split()]
for j in l2:
	b = max(b, j)
print(a, end=' ')
print(b)


def so(a, b):
	a.sort()
	b.sort()
	print(a[-1], end=' ')
	print(b[-1], end=' ')
n = int(input())
a = [int(i) for i in input().split()]
m = int(input())
b = [int(i) for i in input().split()]
ans = so(a, b)
ans


N = int(input())
A = list(map(int, input().split()))
M = int(input())
B = list(map(int, input().split()))
A.sort()
B.sort()
print(A[N - 1], B[M - 1])


n = int(input())
ai = list(map(int, input().split()))
m = int(input())
bi = list(map(int, input().split()))
ai.sort()
bi.sort()
print(ai[-1], bi[-1])


n = int(input())
A = list(map(int, input().split()))
m = int(input())
B = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
print(f'{A[0]} {B[0]}')


N = int(input())
A = [int(x) for x in input().split()]
M = int(input())
B = [int(x) for x in input().split()]
print(max(A), max(B))


def answer():
	a = input()
	b = max([int(x) for x in input().split()])
	a = input()
	c = max([int(x) for x in input().split()])
	print(b, c)
answer()


n = int(input())
n1 = list(map(int, input().split()))
m = int(input())
n2 = list(map(int, input().split()))
print(max(n1), max(n2))


n = int(input())
l = list(map(int, input().split()))
m = int(input())
t = list(map(int, input().split()))
print(max(l), max(t))


n = int(input())
s1 = max([int(i) for i in input().split()])
m = int(input())
s2 = max([int(i) for i in input().split()])
print(s1, s2)


N = int(input())
A = list(map(int, input().split(' ')))
M = int(input())
B = list(map(int, input().split(' ')))
print(max(A), max(B), end=' ')


def swap(a, i, j):
	temp = a[i]
	a[i] = a[j]
	a[j] = temp
n1 = input()
n1 = int(n1)
a = input().split()
n2 = input()
n2 = int(n2)
b = input().split()
for i in range(n1):
	a[i] = int(a[i])
for i in range(n2):
	b[i] = int(b[i])
for i in range(n1 - 1):
	temp = i
	for j in range(i, n1):
		if a[temp] > a[j]:
			swap(a, temp, j)
			temp = j
	if temp != j:
		swap(a, temp, i)
for i in range(n2 - 1):
	temp = i
	for j in range(i, n2):
		if b[temp] > b[j]:
			swap(b, temp, j)
			temp = j
	if temp != j:
		swap(b, temp, i)
print(a[n1 - 1], b[n2 - 1])


def main():
	a_elements = int(input())
	a = [int(x) for x in input().split()]
	max_a = max(a)
	b_elements = int(input())
	b = [int(x) for x in input().split()]
	max_b = max(b)
	print(f'{max_a} {max_b}')
main()


n = int(input())
l = list(map(int, input().split(' ')))
k = int(input())
l2 = list(map(int, input().split(' ')))
print(max(l), max(l2))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
print('%d %d\n' % (max(a), max(b)))


n = int(input())
arr1 = list(map(int, input().split()))
m = int(input())
arr2 = list(map(int, input().split()))
a = max(arr1)
b = max(arr2)
print(a, b)


def main():
	n = input()
	a = list(map(int, input().split()))
	m = input()
	b = list(map(int, input().split()))
	a.sort()
	b.sort()
	print(a[-1], b[-1])
main()


n = int(input())
a = list(map(int, input().split()))
p = int(input())
b = list(map(int, input().split()))
print(max(a), max(b))


from math import *
from sys import *
from collections import defaultdict
M = 10 ** 9 + 7

def pow(a, b):
	res = 1
	while b > 0:
		if b & 1:
			res *= a
		a *= a
		b >>= 1
	return res

def powmod(a, b, m):
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a *= a
		b >>= 1
	return res

def inv(a, m):
	return powmod(a, m - 2, m)

def factor(n):
	potentional_p = 3
	itog_list = {}
	if n % 2 == 0:
		itog_list[2] = 0
	while n % 2 == 0:
		n = n // 2
		itog_list[2] += 1
	while n - 1:
		if potentional_p > n ** 0.5:
			if n in itog_list:
				itog_list[n] += 1
			else:
				itog_list[n] = 1
			return itog_list
		while n % potentional_p == 0:
			n = n // potentional_p
			if potentional_p in itog_list:
				itog_list[potentional_p] += 1
			else:
				itog_list[potentional_p] = 1
		potentional_p += 2
	return itog_list
n = int(stdin.readline())
a = list(map(int, stdin.readline().split()))
n = int(stdin.readline())
b = list(map(int, stdin.readline().split()))
print(max(a), max(b))


n = int(input())
l = list(map(int, input().split()))
m = int(input())
d = list(map(int, input().split()))
print(max(l), max(d))


Z = input()
z = map(int, input().split())
Y = input()
y = map(int, input().split())
print(max(z), max(y))


wyn = 0
for i in range(2):
	n = int(input())
	l = list(map(int, input().split()))
	print(max(l), end=' ')


n = int(input())
elementsOfA = [int(i) for i in input().split()]
m = int(input())
elementsOfB = [int(i) for i in input().split()]
largestElementOfA = -1
largestElementOfB = -1
for item in elementsOfA:
	if item > largestElementOfA:
		largestElementOfA = item
for item in elementsOfB:
	if item > largestElementOfB:
		largestElementOfB = item
print(largestElementOfA, largestElementOfB)


a = int(input())
b = map(int, input().split(maxsplit=a))
c = int(input())
d = map(int, input().split(maxsplit=c))
e = sorted(list(b))
r = sorted(list(d))
print(e[a - 1], r[c - 1])


n = int(input())
l1 = list(map(int, input().split()))
m = int(input())
l2 = list(map(int, input().split()))
print(max(l1), max(l2))


import sys
import os
from io import IOBase, BytesIO

def main():
	n = int(input())
	A = get_array()
	m = int(input())
	B = get_array()
	A.sort()
	B.sort()
	print(A[-1], B[-1])
BUFSIZE = 8192

class FastIO(BytesIO):
	newlines = 0

	def __init__(self, file):
		self._file = file
		self._fd = file.fileno()
		self.writable = 'x' in file.mode or 'w' in file.mode
		self.write = super(FastIO, self).write if self.writable else None

	def _fill(self):
		s = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
		self.seek((self.tell(), self.seek(0, 2), super(FastIO, self).write(s))[0])
		return s

	def read(self):
		while self._fill():
			pass
		return super(FastIO, self).read()

	def readline(self):
		while self.newlines == 0:
			s = self._fill()
			self.newlines = s.count(b'\n') + (not s)
		self.newlines -= 1
		return super(FastIO, self).readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.getvalue())
			(self.truncate(0), self.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		py2 = round(0.5)
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		if py2 == 1:
			self.write = self.buffer.write
			self.read = self.buffer.read
			self.readline = self.buffer.readline
		else:
			self.write = lambda s: self.buffer.write(s.encode('ascii'))
			self.read = lambda : self.buffer.read().decode('ascii')
			self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip()
main()


n = int(input())
a = input().split()
m = int(input())
b = input().split()
for i in range(n):
	a[i] = int(a[i])
for i in range(m):
	b[i] = int(b[i])
a.sort()
b.sort()
k = [a[n - 1], b[m - 1]]
k[0] = str(k[0])
k[1] = str(k[1])
s = ' '.join(k)
print(s)


n1 = int(input())
l1 = input().split(' ')
for i in range(len(l1)):
	l1[i] = int(l1[i])
n2 = int(input())
l2 = input().split(' ')
for i in range(len(l2)):
	l2[i] = int(l2[i])
l1.sort()
l2.sort()
print(l1[n1 - 1], l2[n2 - 1])


n1 = int(input())
a = [int(x) for x in input().split()]
n2 = int(input())
b = [int(x) for x in input().split()]
print(max(a), max(b))


ac = int(input())
a = list(map(int, input().split()))
bc = int(input())
b = list(map(int, input().split()))
print(max(a), max(b))


nA = int(input())
A = list(map(int, input().split()))
nB = int(input())
B = list(map(int, input().split()))
print(max(A), end=' ')
print(max(B))


n = int(input())
l1 = max([int(q) for q in input().split()])
m = int(input())
l2 = max([int(w) for w in input().split()])
print(l1, l2)


int(input())
n = max(map(int, input().split()))
int(input())
m = max(map(int, input().split()))
print(n, m)


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
a.sort()
b.sort()
x = a[n - 1]
y = b[m - 1]
print(f'{x} {y}')


n = int(input())
a = input().split()
m = int(input())
b = input().split()
for i in range(n):
	a[i] = int(a[i])
for j in range(m):
	b[j] = int(b[j])
a.sort()
b.sort()
print(a[n - 1], b[m - 1])


input()
print(max([int(i) for i in input().split()]), end=' ')
input()
print(max([int(i) for i in input().split()]), end=' ')


n = int(input())
a = list(map(int, input().split()))
print(max(a), end=' ')
n = int(input())
a = list(map(int, input().split()))
print(max(a), end=' ')


n = int(input())
na = map(int, input().split())
m = int(input())
ma = map(int, input().split())
print(max(na), max(ma))


n = int(input())
arr1 = [int(i) for i in input().split()]
m = int(input())
arr2 = [int(i) for i in input().split()]
arr1.sort()
arr2.sort()
print(arr1[-1], arr2[-1])


n = int(input())
nn = [*map(int, input().split())]
m = int(input())
mm = [*map(int, input().split())]
nn.sort()
mm.sort()
print(nn[-1], mm[-1])


import sys
f = sys.stdin
n = int(f.readline())
a = list(map(int, f.readline().rstrip().split()))
m = int(f.readline())
b = list(map(int, f.readline().rstrip().split()))
a.sort()
b.sort()
print(str(a[n - 1]) + ' ' + str(b[m - 1]))


R = lambda : map(int, input().split())
input()
l = sorted(R())
input()
k = sorted(R())
print(l[-1], k[-1])


input()
A = list((int(i) for i in input().split()))
input()
B = list((int(i) for i in input().split()))
print(max(A), max(B))


nA = int(input())
A = list(map(int, input().split(' ')))
nB = int(input())
B = list(map(int, input().split(' ')))
max1 = max(A)
max2 = max(B)
print(max1, max2)


a = input()
b = [int(b) for b in input().split()]
b.sort()
c = input()
d = [int(d) for d in input().split()]
d.sort()
print(b[-1], d[-1])


n = int(input())
ar1 = list(map(int, input().split()))
m = int(input())
ar2 = list(map(int, input().split()))
print(max(ar1), max(ar2))


input()
A = set([int(x) for x in input().split()])
input()
B = set([int(x) for x in input().split()])
print(max(A), max(B))


n_A = int(input())
A = [int(i) for i in input().split(' ')]
n_B = int(input())
B = [int(i) for i in input().split(' ')]
A.sort()
B.sort()
print('{} {}'.format(A[-1], B[-1]))


input()
a = sorted(map(int, input().split()), reverse=True)
input()
b = sorted(map(int, input().split()), reverse=True)
print(a[0], b[0])


a = int(input())
am = sorted(list(map(int, input().rstrip().split())))
b = int(input())
bm = sorted(list(map(int, input().rstrip().split())))
print(am[-1], bm[-1])


num = int(input())
num1 = input()
arr = []
for i in num1.split():
	arr.append(int(i))
arr.sort()
if num != len(arr):
	print('error')
num3 = int(input())
num4 = input()
arr1 = []
for i in num4.split():
	arr1.append(int(i))
arr1.sort()
if num3 != len(arr1):
	print('error')
print(str(arr.pop()), str(arr1.pop()))


a = int(input())
a = [int(i) for i in input().split()]
b = int(input())
b = [int(i) for i in input().split()]
a.sort()
b.sort()
print(a[-1], b[-1])


a = int(input())
arr = [int(new) for new in input().split()]
arr.sort()
b = int(input())
brr = [int(new) for new in input().split()]
brr.sort()
print(arr[a - 1], brr[b - 1])


class cinn:

	def __init__(self):
		self.x = []

	def cin(self, t=int):
		if len(self.x) == 0:
			a = input()
			self.x = a.split()
			self.x.reverse()
		return self.get(t)

	def get(self, t):
		return t(self.x.pop())

	def clist(self, n, t=int):
		l = [0] * n
		for i in range(n):
			l[i] = self.cin(t)
		return l

	def clist2(self, n, t1=int, t2=int, t3=int, tn=2):
		l = [0] * n
		for i in range(n):
			if tn == 2:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				l[i] = (a1, a2)
			elif tn == 3:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				a3 = self.cin(t3)
				l[i] = (a1, a2, a3)
		return l

	def clist3(self, n, t1=int, t2=int, t3=int):
		return self.clist2(self, n, t1, t2, t3, 3)

	def cout(self, i, ans=''):
		if ans == '':
			print('Case #' + str(i + 1) + ':', end=' ')
		else:
			print('Case #' + str(i + 1) + ':', ans)

	def printf(self, thing):
		print(thing, end='')

	def countlist(self, l, s=0, e=None):
		if e == None:
			e = len(l)
		dic = {}
		for el in range(s, e):
			if l[el] not in dic:
				dic[l[el]] = 1
			else:
				dic[l[el]] += 1
		return dic

	def talk(self, x):
		print(x, flush=True)

	def dp1(self, k):
		L = [-1] * k
		return L

	def dp2(self, k, kk):
		L = [-1] * k
		for i in range(k):
			L[i] = [-1] * kk
		return L

	def isprime(self, n):
		if n == 1 or n == 0:
			return False
		for i in range(2, int(n ** 0.5 + 1)):
			if n % i == 0:
				return False
		return True

	def factors(self, n):
		from functools import reduce
		return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

	def nthprime(self, n):
		i = 0
		s = 2
		L = []
		while i < n:
			while not self.isprime(s):
				s += 1
			L.append(s)
			s += 1
			i += 1
		return L

	def matrixin(self, m, n, t=int):
		L = []
		for i in range(m):
			p = self.clist(n, t)
			L.append(p)
		return L

	def seive(self, k):
		n = k + 1
		L = [True] * n
		L[1] = False
		L[0] = False
		for i in range(2, n):
			if L[i] == True:
				for j in range(2 * i, n, i):
					L[j] = False
		return L

	def seiven(self, n, L):
		i = 0
		for j in range(len(L)):
			if L[j] == True:
				i += 1
			if i == n:
				return j

	def matrixin2(self, m, t=int):
		L = []
		for i in range(m):
			iny = self.cin(str)
			lsmall = []
			for el in iny:
				lsmall.append(t(el))
			L.append(lsmall)
		return L

def rotcord(i, j, n):
	return (j, n - i - 1)

def rotbje(k):
	if k == '.':
		return k
	ar = ['>', 'v', '<', '^']
	return ar[(ar.index(k) + 1) % 4]
c = cinn()
n = c.cin()
a = c.clist(n)
a.sort()
y = a[n - 1]
x = c.cin()
b = c.clist(x)
b.sort()
f = b[x - 1]
print(y, f)


n = input().split()
a = list(map(int, input().split()))
m = input().split()
b = list(map(int, input().split()))
print(str(max(a)) + ' ' + str(max(b)))


n = int(input())
s = list(map(int, input().split()))
m = int(input())
g = list(map(int, input().split()))
g.sort(reverse=True)
s.sort(reverse=True)
print(s[0], g[0])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
print(max(a), max(b), sep=' ')


x = input()
first = map(int, input().split(' '))
y = input()
second = map(int, input().split(' '))
print(max(first), max(second))


n = int(input())
A = list(map(int, input().split()))
m = int(input())
B = list(map(int, input().split()))
x = sorted(A)[-1]
y = sorted(B)[-1]
print(x, y)


input()
l = list(map(int, input().split()))
input()
m = list(map(int, input().split()))
print(max(l), max(m))


def main():
	n = input()
	ns = set([int(x) for x in input().split(' ')])
	m = input()
	ms = set([int(x) for x in input().split(' ')])
	print(str(max(ns)) + ' ' + str(max(ms)))
main()


a = int(input())
if a == 1:
	al = int(input())
else:
	al = list(map(int, input().split()))
b = int(input())
if b == 1:
	bl = int(input())
else:
	bl = list(map(int, input().split()))
if a == 1 and b == 1:
	print(al, end=' ')
	print(bl)
elif a == 1 and b > 1:
	print(al, end=' ')
	print(max(bl))
elif b == 1 and a > 1:
	print(max(al), end=' ')
	print(bl)
else:
	print(max(al), end=' ')
	print(max(bl))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
ma = max(a)
mb = max(b)
print(ma, mb)


a = int(input())
al = list(map(int, input().split()))
b = int(input())
bl = list(map(int, input().split()))
al.sort()
bl.sort()
print(al[-1], end=' ')
print(bl[-1])


n = int(input())
arr = list(map(int, input().split()))
m = int(input())
arr1 = list(map(int, input().split()))
print(max(arr), max(arr1))


from math import *
m = []
n = []
for i in range(2):
	y = input()
	x = list(map(int, input().split()))
	x.sort(reverse=True)
	m.append(x)
print(m[0][0], end=' ')
print(m[1][0])


na = int(input())
a = str(input()).split()
nb = int(input())
b = str(input()).split()
maxa = -1
maxb = -1
for x in a:
	maxa = max(int(x), maxa)
for x in b:
	maxb = max(int(x), maxb)
print(maxa, maxb)


def I():
	return map(int, input().split())
n = int(input())
a = sorted(list(I()))
m = int(input())
b = sorted(list(I()))
if (a[-1] + b[-1] < a[0] or a[-1] + b[-1] > a[-1]) and (a[-1] + b[-1] < b[0] or a[-1] + b[-1] > b[-1]):
	print(a[-1], b[-1])
else:
	print(a[0], b[0])


def choose2num(a, b):
	return [max(a), max(b)]
na = int(input())
ea = list(map(int, input().split()))
nb = int(input())
eb = list(map(int, input().split()))
print(*choose2num(ea, eb))


def solve():
	n = int(input())
	a = [int(s) for s in input().split()]
	m = int(input())
	b = [int(s) for s in input().split()]
	print(max(a), max(b))
solve()


n1 = int(input())
numList1 = [int(x) for x in input().split()]
n2 = int(input())
numList2 = [int(x) for x in input().split()]
print(max(numList1), max(numList2))


a = int(input())
A = [int(x) for x in input().split(' ', a - 1)]
b = int(input())
B = [int(y) for y in input().split(' ', b - 1)]
print(max(A), max(B))


ax = int(input())
a = [int(el) for el in input().split()]
bx = int(input())
b = [int(el) for el in input().split()]
print(max(a), max(b), sep=' ')


def count(n, numsA, m, numsB):
	(maxA, maxB) = (max(numsA), max(numsB))
	return str(maxA) + ' ' + str(maxB)
n = int(input())
numsA = [int(i) for i in input().split()]
m = int(input())
numsB = [int(i) for i in input().split()]
print(count(n, numsA, m, numsB))


n = int(input())
A = list(map(int, input().split()))
m = int(input())
B = list(map(int, input().split()))
max_A = max(A)
max_B = max(B)
print(max_A, max_B)


from sys import stdin, setrecursionlimit
setrecursionlimit(10 ** 6)
input = stdin.readline
n = int(input().rstrip())
a = sorted([int(i) for i in input().split()], reverse=1)
m = int(input().rstrip())
b = sorted([int(i) for i in input().split()], reverse=1)
print(a[0], b[0])


t = int(input())
l = list(map(int, input().split(' ')))
n = int(input())
k = list(map(int, input().split(' ')))
l.sort(reverse=True)
k.sort(reverse=True)
print(str(l[0]) + ' ' + str(k[0]))


def choose2num():
	inp1 = int(input())
	inpa1 = map(int, input().split())
	int(input())
	inpa2 = map(int, input().split())
	print(max(inpa1), max(inpa2))
choose2num()


_ = input()
a = list(map(int, input().split()))
_ = input()
b = list(map(int, input().split()))
a.sort()
b.sort()
print(a[-1], b[-1])


n = int(input())
x = list(map(int, input().split()))
m = int(input())
y = list(map(int, input().split()))
x.sort()
y.sort()
print(x[n - 1], y[m - 1])


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	n = int(input())
	a = max((int(i) for i in input().split()))
	m = int(input())
	b = max((int(i) for i in input().split()))
	print(a, b)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


m = int(input())
arr1 = set(map(int, input().split()))
n = int(input())
arr2 = set(map(int, input().split()))
print(str(max(arr1)) + ' ' + str(max(arr2)))


list1 = []
n1 = int(input())
list1 = [int(num) for num in input().split()]
list2 = []
n2 = int(input())
list2 = [int(num) for num in input().split()]
max1 = 0
for i in range(0, n1):
	if max1 < list1[i]:
		max1 = list1[i]
max2 = 0
for j in range(0, n2):
	if max2 < list2[j]:
		max2 = list2[j]
print(max1, max2)


def solve():
	input()
	return max(map(int, input().split()))
print(solve(), solve())


n = int(input())
a = input()
m = int(input())
b = input()
p = a.split()
q = [int(d) for d in p]
r = b.split()
s = [int(d) for d in r]
q.sort()
s.sort()
print(q[-1], s[-1])


import math
n = int(input())
list1 = input().split()
for i in range(len(list1)):
	list1[i] = int(list1[i])
m = int(input())
list2 = input().split()
for i in range(len(list2)):
	list2[i] = int(list2[i])
list1.sort()
list2.sort()
print(str(list1[n - 1]) + ' ' + str(list2[m - 1]))


from collections import defaultdict, Counter
import copy, math
from copy import deepcopy
n = int(input())
l = list(map(int, input().split()))
l.sort()
m = int(input())
ll = list(map(int, input().split()))
ll.sort()
print(l[-1], ll[-1])


from sys import stdin, stdout
a = int(input())
arr1 = [int(x) for x in stdin.readline().split()]
b = int(input())
arr2 = [int(y) for y in stdin.readline().split()]
print(str(max(arr1)) + ' ' + str(max(arr2)))


import getpass
import sys
if getpass.getuser() != 'frohenk':
	filename = 'half'
else:
	sys.stdin = open('input.txt')
import math
import string
import re
import random
from decimal import Decimal, getcontext
from collections import deque
mod = 10 ** 9 + 7

def ria():
	return [int(i) for i in input().split()]
n = ria()[0]
a = max(ria())
n = ria()[0]
b = max(ria())
print(a, b)


n_a = int(input())
a = []
data = input().split(' ')
for i in data:
	a.append(int(i))
n_b = int(input())
b = []
data = input().split(' ')
for i in data:
	b.append(int(i))
max_a = max(a)
max_b = max(b)
print(max_a, max_b)


n = int(input())
arrn = list(map(int, input().split()))
m = int(input())
arrm = list(map(int, input().split()))
arrn.sort()
arrm.sort()
print(arrn[-1], arrm[-1])


def lista(A, B):
	return (max(A), max(B))
nA = int(input())
A = [int(x) for x in input().split()]
nB = int(input())
B = [int(x) for x in input().split()]
print(max(A), max(B))


t = input()
z = map(int, input().split())
n = input()
y = map(int, input().split())
print(max(z), max(y))


a = int(input())
A = map(int, input().split())
b = int(input())
B = map(int, input().split())
print(max(A), max(B))


n = int(input())
arr1 = list(map(int, input().strip().split()))[:n]
k = int(input())
arr2 = list(map(int, input().strip().split()))[:k]
print(max(arr1), end=' ')
print(max(arr2))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
print('{} {}'.format(max(a), max(b)))


n = int(input())
A = [int(x) for x in input().split()]
m = int(input())
B = [int(x) for x in input().split()]
A.sort()
B.sort()
print(str(A[-1]) + ' ' + str(B[-1]))


a = int(input())
a1 = list(map(int, input().split()))
b = int(input())
b1 = list(map(int, input().split()))
a1.sort()
b1.sort()
print(a1[-1], b1[-1])


I = input
n = int(I())
a = sorted(map(int, I().split()))
m = int(I())
b = sorted(map(int, I().split()))
print(a[n - 1], end=' ')
print(b[m - 1], end=' ')


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
a1 = max(a)
a2 = min(a)
b1 = max(b)
b2 = min(b)
maxi = a1 + b1
mini = a2 + b2
if maxi not in a and maxi not in b:
	print(a1, b1)
else:
	print(a2, b2)


n = int(input())
li = list(map(int, input().split()))
k = int(input())
test = list(map(int, input().split()))
print(max(li), max(test))


n = int(input())
a = tuple([int(x) for x in input().split()])
m = int(input())
b = tuple([int(x) for x in input().split()])
i = max(a)
j = max(b)
print(f'{i} {j}', end='')


n = int(input())
a = input().split()
m = int(input())
b = input().split()
for i in range(0, n):
	a[i] = int(a[i])
for i in range(0, m):
	b[i] = int(b[i])
a.sort()
b.sort()
print(a[n - 1], end=' ')
print(b[m - 1])


def nextInt():
	return int(input())

def nextInts():
	return map(int, input().split())
n = nextInt()
a = nextInts()
m = nextInt()
b = nextInts()
print(max(a), max(b))


n = int(input())
data1 = [int(i) for i in input().split()]
m = int(input())
data2 = [int(i) for i in input().split()]
print(max(data1), max(data2))


def toint(l):
	for i in range(len(l)):
		l[i] = int(l[i])
	return l
na = int(input())
a = input()
a = a.split()
a = toint(a)
nb = int(input())
b = input()
b = b.split()
b = toint(b)
ma = max(a)
mb = max(b)
print(ma, mb, sep=' ')


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
a.sort()
b.sort()
print(max(a), max(b))


n = int(input())
l1 = list(map(int, input().split()))
m = int(input())
l2 = list(map(int, input().split()))
x = max(l1)
y = max(l2)
print(x, y)


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = 1
for tt in range(t):
	n = int(input())
	a = list(map(int, sys.stdin.readline().split(' ')))
	nn = int(input())
	b = list(map(int, sys.stdin.readline().split(' ')))
	print(max(a), max(b))
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


n = int(input())
x = [int(i) for i in input().split()]
maxx = -99999
for key in x:
	if key > maxx:
		maxx = key
m = int(input())
y = [int(i) for i in input().split()]
maxy = -99999
for key in y:
	if key > maxy:
		maxy = key
print(maxx, maxy)


import sys
from math import sqrt, floor, factorial
from collections import deque
inp = sys.stdin.readline
read = lambda : list(map(int, inp().strip().split()))

def solve():
	n = int(inp())
	arr1 = max(read())
	m = int(inp())
	arr2 = max(read())
	print(arr1, arr2)
solve()


a = int(input())
list_a = list(map(int, input().split(' ')))
b = int(input())
list_b = list(map(int, input().split(' ')))
for i in range(len(list_a) - 1):
	if list_a[i + 1] < list_a[i]:
		c = list_a[i + 1]
		list_a[i + 1] = list_a[i]
		list_a[i] = c
for i in range(len(list_b) - 1):
	if list_b[i + 1] < list_b[i]:
		d = list_b[i + 1]
		list_b[i + 1] = list_b[i]
		list_b[i] = d
print(list_a[a - 1], list_b[b - 1])


lenA = int(input())
A = [int(x) for x in input().split()]
lenB = int(input())
B = [int(x) for x in input().split()]
print(max(A), max(B))


n = int(input())
arr = list(map(int, input().split()))
n2 = int(input())
arr2 = list(map(int, input().split()))
arr.sort()
arr2.sort()
print(arr[-1], arr2[-1])


iloA = int(input())
inpA = input().split()
iloB = int(input())
inpB = input().split()
tabA = []
tabB = []
for i in range(iloA):
	tabA.append(int(inpA[i]))
for i in range(iloB):
	tabB.append(int(inpB[i]))
tabA.sort(reverse=True)
tabB.sort(reverse=True)
print(tabA[0], tabB[0])


t = 1
while t > 0:
	t -= 1
	n = int(input())
	l = list(map(int, input().split()))
	k = int(input())
	l1 = list(map(int, input().split()))
	l.sort()
	l1.sort()
	print(l[-1], l1[-1])


k = int(input())
A = [*map(int, input().split())]
i = int(input())
B = [*map(int, input().split())]
print(max(A), max(B))


n = input()
max_n = max(map(int, input().split(' ')))
m = input()
max_m = max(map(int, input().split(' ')))
print(max_n, max_m)


a = input()
b = input()
c = input()
d = input()
b = [int(e) for e in b.split()]
d = [int(e) for e in d.split()]
print('%s %s' % (max(b), max(d)))


na = int(input())
la = list(map(int, input().split()))
nb = int(input())
lb = list(map(int, input().split()))
la.sort()
lb.sort()
print(la[-1], lb[-1])


n = int(input())
a = [int(i) for i in input().split()]
m = int(input())
b = [int(i) for i in input().split()]
maxA = max(a)
maxB = max(b)
print(maxA, maxB)


n = int(input())
a = [int(x) for x in input().split()]
n1 = int(input())
b = [int(x) for x in input().split()]
print(max(a), max(b))


a1 = int(input())
a = list(map(int, input().split()))
b1 = int(input())
b = list(map(int, input().split()))
k = max(a)
j = max(b)
print(k, j)


M = int(input())
numList1 = list(map(int, input().split()))
N = int(input())
numList2 = list(map(int, input().split()))
print(max(numList1), max(numList2))


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0)
input()
a = max(get_list())
input()
b = max(get_list())
print(a, b)


(a, max1) = (input(), max(map(int, input().split())))
(b, max2) = (input(), max(map(int, input().split())))
print(max1, max2)


(a, b) = [list(map(int, input().split())) for i in range(4)][1::2]
print(max(a), max(b))


import math
import sys
import collections

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)
n = ii()
d = sorted(li())
m = ii()
t = sorted(li())
print(d[-1], t[-1])


t = int(input())
k = list(map(int, input().split()))
l = int(input())
m = list(map(int, input().split()))
print(max(k), max(m))


print(*(max(map(int, input() and input().split())) for _ in '00'))


e = int(input())
x = [int(t) for t in input().split()]
c = int(input())
y = [int(l) for l in input().split()]
(m, n) = (sorted(x), sorted(y))
print(m[len(x) - 1], n[len(y) - 1])


n = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
m = int(input())
b = sorted(list(map(int, input().split())), reverse=True)
print(a[0], b[0])


import sys
import math
import random
input = sys.stdin.readline
n = map(int, input().split())
a = list(map(int, input().split()))
m = map(int, input().split())
b = list(map(int, input().split()))
a.sort()
b.sort()
print(a[len(a) - 1], b[len(b) - 1])


n = int(input())
max_a = -9999999
splits = input().split(' ')
for i in range(n):
	val = int(splits[i])
	if val > max_a:
		max_a = val
m = int(input())
max_b = -9999999
splits = input().split(' ')
for i in range(m):
	val = int(splits[i])
	if val > max_b:
		max_b = val
print(max_a, max_b)


input()
l1 = sorted(map(int, input().split()))
input()
l2 = sorted(map(int, input().split()))
print(l1[-1], l2[-1])


print('%d %d' % (lambda n, max_a, m, max_b: (max_a, max_b))(int(input()), max(map(int, input().split())), int(input()), max(map(int, input().split()))))


a = int(input())
lst1 = list(map(int, input().split()))
b = int(input())
lst2 = list(map(int, input().split()))
print(max(lst1), max(lst2))


a = int(input())
lst1 = sorted(list(map(int, input().split())))
b = int(input())
lst2 = sorted(list(map(int, input().split())))
print(lst1[-1], lst2[-1])


n1 = int(input())
num1 = input()
a = []
b = []

def get_the_data(count, num, arr):
	for i in range(0, len(num)):
		if num[i] == ' ':
			arr.append(int(num[count:i]))
			count = i + 1
		elif i == len(num) - 1:
			arr.append(int(num[count:len(num)]))
	return arr
arr1 = get_the_data(0, num1, a)
n2 = int(input())
num2 = input()
arr2 = get_the_data(0, num2, b)
arr1.sort()
arr2.sort()
print(str(arr1[len(arr1) - 1]) + ' ' + str(arr2[len(arr2) - 1]))


n = int(input())
mA = max(map(int, input().split()))
n = int(input())
mB = max(map(int, input().split()))
print(mA, mB)


def fun(a, b):
	sum = 0
	a.sort()
	b.sort()
	sum += a[-1] + b[-1]
	print(a[-1], b[-1])
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
fun(a, b)


nomer = 0
n = input()
A = [int(n) for n in input().split()]
m = input()
B = [int(m) for m in input().split()]
while nomer < len(A):
	plusiki = nomer
	bigestnumber = nomer
	while plusiki < len(A):
		if A[plusiki] < A[bigestnumber]:
			bigestnumber = plusiki
		plusiki = plusiki + 1
	(A[nomer], A[bigestnumber]) = (A[bigestnumber], A[nomer])
	nomer = nomer + 1
nomer = 0
while nomer < len(B):
	plusiki = nomer
	bigestnumber = nomer
	while plusiki < len(B):
		if B[plusiki] < B[bigestnumber]:
			bigestnumber = plusiki
		plusiki = plusiki + 1
	(B[nomer], B[bigestnumber]) = (B[bigestnumber], B[nomer])
	nomer = nomer + 1
print(A[len(A) - 1], B[len(B) - 1])


t = int(input())
l1 = list(map(int, input().split()))
k = int(input())
l2 = list(map(int, input().split()))
print(max(l1), max(l2))


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
m1 = max(a)
m2 = max(b)
print(m1, m2)


n = int(input())
ar = list(map(int, input().split()))
m = int(input())
ar1 = list(map(int, input().split()))
print(max(ar), max(ar1))


n = int(input())
arr1 = list(map(int, input().split()))
m = int(input())
arr2 = list(map(int, input().split()))
print(str(max(arr1)) + ' ' + str(max(arr2)))


input()
a = [int(s) for s in input().split()]
input()
b = [int(s) for s in input().split()]
print(max(a), max(b))


import sys
import math
from collections import defaultdict
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
x = max(a)
y = max(b)
print(x, y)


n = int(input())
arr = list(map(int, input().split()))
n1 = int(input())
brr = list(map(int, input().split()))
arr.sort()
brr.sort()
print(arr[-1], brr[-1])


n = int(input())
A = sorted([*map(int, input().split())])
m = int(input())
B = sorted([*map(int, input().split())])
print(A[-1], B[-1])


def choose():
	inp1 = input()
	inpa1 = map(int, input().split())
	inp2 = input()
	inpa2 = map(int, input().split())
	print(max(inpa1), max(inpa2))
choose()


n = int(input())
l1 = list(map(int, input().split()))
k = int(input())
l2 = list(map(int, input().split()))
l1.sort()
l2.sort()
print(l1[len(l1) - 1], l2[len(l2) - 1])


x = int(input())
a = list(map(int, input().split()))
y = int(input())
b = list(map(int, input().split()))
a.sort()
b.sort()
print(a[-1], b[-1])


input()
a = list(map(int, input().split()))
input()
b = list(map(int, input().split()))
a.sort()
b.sort()
maxa = max(a)
maxb = max(b)
print(maxa, max(b))


size1 = int(input())
a1 = list(map(int, input().split()))
size2 = int(input())
a2 = list(map(int, input().split()))
val1 = max(a1)
val2 = max(a2)
print(val1, val2)


def inp():
	return map(int, input().split())

def inp_arr():
	return list(map(int, input().split()))
n1 = int(input())
a = inp_arr()
n2 = int(input())
b = inp_arr()
print(str(max(a)) + ' ' + str(max(b)))


x = int(input())
sun = 0
mx = max(map(int, input().split()))
x = int(input())
mn = max(map(int, input().split()))
print(mx, mn)


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
mxa = 0
mxb = 0
for i in a:
	mxa = max(mxa, i)
for i in b:
	mxb = max(mxb, i)
print(str(mxa) + ' ' + str(mxb))


from sys import stdin
input = stdin.readline
n = int(input())
a = sorted([int(i) for i in input().split()])
m = int(input())
b = sorted([int(i) for i in input().split()])
print(str(a[n - 1]) + ' ' + str(b[m - 1]))


a = input()
l1 = [int(x) for x in input().split()]
b = input()
l2 = [int(i) for i in input().split()]
print(max(l1), max(l2))


input()
a = max(map(int, input().split()))
input()
b = max(map(int, input().split()))
print(str(a) + ' ' + str(b))


def ii():
	return int(input())

def lmii():
	return list(map(int, input().split()))
n = ii()
na = lmii()
m = ii()
ma = lmii()
na.sort()
ma.sort()
print(na[n - 1], ma[m - 1])


n = int(input())
l = [int(s) for s in input().split()]
m = int(input())
l1 = [int(s) for s in input().split()]
l.sort()
l1.sort()
print(l[-1], l1[-1])


n = input()
A = map(int, input().split(' '))
m = input()
B = map(int, input().split(' '))
print(str(max(A)) + ' ' + str(max(B)))


(n, a) = (input(), [int(i) for i in input().strip().split()])
(m, b) = (input(), [int(i) for i in input().strip().split()])
print(max(a), max(b))


n = int(input())
s1 = list(map(int, input().split()))
m = int(input())
s2 = list(map(int, input().split()))
d = max(s1)
k = max(s2)
print(d, k)


n = int(input())
a = [int(x) for x in input().strip().split()]
m = int(input())
b = [int(x) for x in input().strip().split()]
a.sort()
b.sort()
print(a[-1], b[-1])


NA = int(input())
S0 = sorted(list(map(int, input().split())))
NB = int(input())
S1 = sorted(list(map(int, input().split())))
print(S0[len(S0) - 1], S1[len(S1) - 1])


n = int(input())
lis = list(map(int, input().split()))
m = int(input())
li = list(map(int, input().split()))
a = max(lis)
b = max(li)
print(a, b)


import sys
import math as mt
input = sys.stdin.buffer.readline
t = 1
for __ in range(t):
	n = int(input())
	l = list(map(int, input().split()))
	m = int(input())
	l1 = list(map(int, input().split()))
	print(max(l[:]), max(l1[:]))


I = input
R = lambda : map(int, I().split())
I()
a = R()
I()
print(max(a), max(R()))


firstArraySize = int(input())
firstArray = list(map(int, input().split()))
secondArraySize = int(input())
secondArray = list(map(int, input().split()))
print(str(max(firstArray)) + ' ' + str(max(secondArray)))


a_N = int(input())
a = sorted(list(map(int, input().split())))
b_N = int(input())
b = sorted(list(map(int, input().split())))
print(a[-1], b[-1])


n = int(input())
list1 = list(map(int, input().split()))
m = int(input())
list2 = list(map(int, input().split()))
print(max(list1), max(list2))


n = input()
a = list(map(int, input().split()))
n = input()
b = list(map(int, input().split()))
a.sort()
b.sort()
print(a[-1], b[-1])


def mp():
	return map(int, input().split())
n = int(input())
a = list(mp())
m = int(input())
b = list(mp())
print(max(a), max(b))


from sys import stdin, stdout
from collections import Counter
import math

def rsingle_int():
	return int(stdin.readline().rstrip())

def rmult_int():
	return [int(x) for x in stdin.readline().rstrip().split()]

def rmult_str():
	return stdin.readline().rstrip().split()

def r_str():
	return stdin.readline().rstrip()

def rsingle_char():
	return stdin.read(1)

def main():
	n = rsingle_int()
	a = rmult_int()
	m = rsingle_int()
	b = rmult_int()
	max_a = 0
	for el in a:
		if el > max_a:
			max_a = el
	max_b = 0
	for el in b:
		if el > max_b:
			max_b = el
	print(*[max_a, max_b])
main()


t1 = int(input())
lista1 = [int(x) for x in input().split()]
t2 = int(input())
lista2 = [int(y) for y in input().split()]
print(max(lista1), max(lista2))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_intList_from_str = lambda : list(map(int, list(sys.stdin.readline().strip())))
get_charList_from_str = lambda : list(sys.stdin.readline().strip())
get_char_list = lambda : sys.stdin.readline().strip().split()
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x))
n1 = get_int()
lst1 = sorted(get_int_list())
n2 = get_int()
lst2 = sorted(get_int_list())
print(lst1[-1], lst2[-1])


n1 = int(input())
l1 = list(map(int, input().split()))
l1.sort()
n2 = int(input())
l2 = list(map(int, input().split()))
l2.sort()
print(l1[-1], end=' ')
print(l2[-1])


n = int(input())
a = list(map(int, input().split()))
m = int(input())
b = list(map(int, input().split()))
ra = max(a)
rb = max(b)
print(ra, rb)


n = int(input())
l = list(map(int, input().split()))
m = int(input())
l2 = list(map(int, input().split()))
l.sort()
l2.sort()
print(l[-1], l2[-1])


n = int(input())
lis = [int(i) for i in input().split()]
m = int(input())
lis1 = [int(i) for i in input().split()]
print(max(lis), max(lis1))


int(input())
x = max([int(q) for q in input().split()])
int(input())
y = max([int(q) for q in input().split()])
print(x, y)


a = int(input())
a_list = list(map(int, input().split()))
b = int(input())
b_list = list(map(int, input().split()))
a_list.sort(reverse=True)
b_list.sort(reverse=True)
print(a_list[0], b_list[0])


n1 = int(input())
a = [int(i) for i in input().split()]
n2 = int(input())
b = [int(i) for i in input().split()]
print(max(a), max(b))


N = int(input())
A = tuple(map(int, input().split()))
M = int(input())
B = tuple(map(int, input().split()))
print(max(A), max(B))


def naiveSolve(n):
	return

def main():
	input()
	a = max(readIntArr())
	input()
	b = max(readIntArr())
	print('{} {}'.format(a, b))
	return
import sys
input = sys.stdin.buffer.readline

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]

def makeArr(defaultValFactory, dimensionArr):
	dv = defaultValFactory
	da = dimensionArr
	if len(da) == 1:
		return [dv() for _ in range(da[0])]
	else:
		return [makeArr(dv, da[1:]) for _ in range(da[0])]

def queryInteractive(l, r):
	print('? {} {}'.format(l, r))
	sys.stdout.flush()
	return int(input())

def answerInteractive(x):
	print('! {}'.format(x))
	sys.stdout.flush()
inf = float('inf')
MOD = 10 ** 9 + 7
from math import gcd, floor, ceil
for _abc in range(1):
	main()


n1 = int(input())
c1 = sorted(list(map(int, input().split())))
n2 = int(input())
c2 = sorted(list(map(int, input().split())))
print(c1[-1], c2[-1])


n = int(input())
a1 = list(map(int, input().split()))
m = int(input())
b1 = list(map(int, input().split()))
print(str(sorted(a1)[-1]) + ' ' + str(sorted(b1)[-1]))


n = int(input())
l = list(map(int, input().split()))
m = int(input())
ml = list(map(int, input().split()))
print(max(l), max(ml))