A,B,K=list(map(int,input().split()))

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

ans=[]
for i in range(1,101):
  if A%i ==0 and B%i==0:
    ans.append(i)
A=ans[::-1]
print(A[K-1])