n = int(eval(input()))

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

m = min(hps)

def gojo(a, b):

  if b == 0:

    return a

  else:

    return gojo(b, a % b)

res = m

for hp in hps:

  res = gojo(max(res, hp),min(res, hp))

print(res)
n = int(eval(input()))

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

m = min(hps)

def gojo(a, b):

  if b == 0:

    return a

  else:

    return gojo(b, a % b)

res = m

for hp in hps:

  res = gojo(hp, res)

print(res)
n = int(eval(input()))
hps = list(map(int, input().split()))
m = min(hps)


def gojo(a, b):
    if b == 0:
        return a
    else:
        return gojo(b, a % b)


res = m
for hp in hps:
    res = gojo(max(res, hp), min(res, hp))
print(res)

n = int(eval(input()))
hps = list(map(int, input().split()))
m = min(hps)


def gojo(a, b):
    if b == 0:
        return a
    else:
        return gojo(b, a % b)


res = m
for hp in hps:
    res = gojo(hp, res)
print(res)

-    res = gojo(max(res, hp), min(res, hp)) +    res = gojo(hp, res)