a,b,k = map(int, input().split())
s = []
for i in range(1,101):
    if a % i == 0 and b % i == 0:
        s.append(i)
    if i > a or i > b:
        break
print(s[-k]) a,b,k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k s = [] s [] for i in range(1,101):
    if a % i == 0 and b % i == 0:
        s.append(i)
    if i > a or i > b:
        break i range(1,101) range 1 101 if a % i == 0 and b % i == 0:
        s.append(i)
     a % i == 0 and b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 s.append(i) s.append s append i if i > a or i > b:
        break i > a or i > b i > a i a i > b i b break print(s[-k]) print s[-k] s -k k a,b,k = map(int, input().split()) map(int, input().split()) a b,k = map(int, input().split()) map(int, input().split()) b k = map(int, input().split()) map(int, input().split()) k s = [] [] s
a,b,k = map(int, input().split())
s = []
for i in range(1,101):
    if a % i == 0 and b % i == 0:
        s.append(i)
    if i > a or i > b:
        break
print(s[-k])
