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