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