def gcd(a,b):

  if b==0:

    return a

  else:

    return gcd(b,a%b)



N=int(eval(input()))

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

g=A[0]



for i in range(1,N):

  g=gcd(g,A[i])



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

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



def gcd(x, y):

  while y:

    x, y = y, x % y

  return x



answer = A[0]

for i in range(1, N):

  answer = gcd(A[i], answer)

  

print(answer)
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


N = int(eval(input()))
A = list(map(int, input().split()))
g = A[0]
for i in range(1, N):
    g = gcd(g, A[i])
print(g)

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


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


answer = A[0]
for i in range(1, N):
    answer = gcd(A[i], answer)
print(answer)

-def gcd(a, b): -    if b == 0: -        return a -    else: -        return gcd(b, a % b) +N = int(eval(input())) +A = list(map(int, input().split())) -N = int(eval(input())) -A = list(map(int, input().split())) -g = A[0] +def gcd(x, y): +    while y: +        x, y = y, x % y +    return x + + +answer = A[0] -    g = gcd(g, A[i]) -print(g) +    answer = gcd(A[i], answer) +print(answer)