import fractions

from functools import reduce



def gcd(*numbers):

    return reduce(fractions.gcd, numbers)



def gcd_list(numbers):

    return reduce(fractions.gcd, numbers)



n = int(eval(input()))

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



print((gcd(*a)))
n = int(eval(input()))

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



import math

from functools import reduce



def gcd(*numbers):

    return reduce(math.gcd, numbers)



def gcd_list(numbers):

    return reduce(math.gcd, numbers)



print((gcd(*a)))
import fractions
from functools import reduce


def gcd(*numbers):
    return reduce(fractions.gcd, numbers)


def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)


n = int(eval(input()))
a = list(map(int, input().split()))
print((gcd(*a)))

n = int(eval(input()))
a = list(map(int, input().split()))
import math
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)


def gcd_list(numbers):
    return reduce(math.gcd, numbers)


print((gcd(*a)))

-import fractions +n = int(eval(input())) +a = list(map(int, input().split())) +import math -    return reduce(fractions.gcd, numbers) +    return reduce(math.gcd, numbers) -    return reduce(fractions.gcd, numbers) +    return reduce(math.gcd, numbers) -n = int(eval(input())) -a = list(map(int, input().split()))