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