N = int(eval(input()))

#A = [int(i) for i in input().split()]

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



def gcp(a,b):

    if b == 0:

        return a

    else:

        return gcp(b,a%b)



a = A[0]

for i in range(1,N):

    a = gcp(a,A[i])

print(a)
eval(input())

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



b = min(A)

for a in A:

    while True:

        if a%b == 0:

            break

        a,b = b, a%b

print(b)
N = int(eval(input()))
# A = [int(i) for i in input().split()]
A = list(map(int, input().split()))


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


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

eval(input())
A = list(map(int, input().split()))
b = min(A)
for a in A:
    while True:
        if a % b == 0:
            break
        a, b = b, a % b
print(b)

-N = int(eval(input())) -# A = [int(i) for i in input().split()] +eval(input()) - - -def gcp(a, b): -    if b == 0: -        return a -    else: -        return gcp(b, a % b) - - -a = A[0] -for i in range(1, N): -    a = gcp(a, A[i]) -print(a) +b = min(A) +for a in A: +    while True: +        if a % b == 0: +            break +        a, b = b, a % b +print(b)