A,B,K=map(int,input().split())
if A>=B:
    A^=B
    B^=A
    A^=B
a=[]
for i in range(1,A+1):
    if A%i==0 and B%i==0:
        a.append(i)
print(a[-K]) A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K if A>=B:
    A^=B
    B^=A
    A^=B A>=B A B A^=B A B B^=A B A A^=B A B a=[] a [] for i in range(1,A+1):
    if A%i==0 and B%i==0:
        a.append(i) i range(1,A+1) range 1 A+1 A 1 if A%i==0 and B%i==0:
        a.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 a.append(i) a.append a append i print(a[-K]) print a[-K] a -K K B^=A A B A^=B B A A,B,K=map(int,input().split()) map(int,input().split()) A B,K=map(int,input().split()) map(int,input().split()) B A^=B B A K=map(int,input().split()) map(int,input().split()) K a=[] [] a
A,B,K=map(int,input().split())
if A>=B:
    A^=B
    B^=A
    A^=B
a=[]
for i in range(1,A+1):
    if A%i==0 and B%i==0:
        a.append(i)
print(a[-K])
