a,b,k=map(int,input().split())
ls = []
for i in range(1,101):
    if a % i == 0 and b % i == 0:
        ls.append(i)
print(ls[-k]) a,b,k=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k ls = [] ls [] for i in range(1,101):
    if a % i == 0 and b % i == 0:
        ls.append(i) i range(1,101) range 1 101 if a % i == 0 and b % i == 0:
        ls.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 ls.append(i) ls.append ls append i print(ls[-k]) print ls[-k] ls -k k b,k=map(int,input().split()) map(int,input().split()) b k=map(int,input().split()) map(int,input().split()) k a,b,k=map(int,input().split()) map(int,input().split()) a ls = [] [] ls
a,b,k=map(int,input().split())
ls = []
for i in range(1,101):
    if a % i == 0 and b % i == 0:
        ls.append(i)
print(ls[-k])