N = int(eval(input()))

L = list(map(int,input().split()))

L.sort()

def gcd(x,y):

  while y != 0:

    k = x

    x = y

    y = k%y

  return x

G = gcd(L[0],L[1])

for i in range(1,N-1):

  if G >= gcd(L[i],L[i+1]):

    G = gcd(L[i],L[i+1])

print(G)
N = int(eval(input()))

L = list(map(int,input().split()))

L.sort()

def gcd(x,y):

  while y != 0:

    k = x

    x = y

    y = k%y

  return  x

cur = L[0]

for i in range(N):

  cur = gcd(cur,L[i])

print(cur)
N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()


def gcd(x, y):
    while y != 0:
        k = x
        x = y
        y = k % y
    return x


G = gcd(L[0], L[1])
for i in range(1, N - 1):
    if G >= gcd(L[i], L[i + 1]):
        G = gcd(L[i], L[i + 1])
print(G)

N = int(eval(input()))
L = list(map(int, input().split()))
L.sort()


def gcd(x, y):
    while y != 0:
        k = x
        x = y
        y = k % y
    return x


cur = L[0]
for i in range(N):
    cur = gcd(cur, L[i])
print(cur)

-G = gcd(L[0], L[1]) -for i in range(1, N - 1): -    if G >= gcd(L[i], L[i + 1]): -        G = gcd(L[i], L[i + 1]) -print(G) +cur = L[0] +for i in range(N): +    cur = gcd(cur, L[i]) +print(cur)