A,B,K=map(int,input().split())
count=0
i=min(A,B)+1
while count<K:
    i-=1
    if A%i==0 and B%i==0:
        count+=1
print(i) A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K count=0 count 0 i=min(A,B)+1 i min(A,B)+1 min(A,B) min A B 1 while count<K:
    i-=1
    if A%i==0 and B%i==0:
        count+=1 count<K count K i-=1 i 1 if A%i==0 and B%i==0:
        count+=1 A%i==0 and B%i==0 A%i==0 A%i A i 0 B%i==0 B%i B i 0 count+=1 count 1 print(i) print i K=map(int,input().split()) map(int,input().split()) K count+=1 1 count A,B,K=map(int,input().split()) map(int,input().split()) A count=0 0 count i-=1 1 i i=min(A,B)+1 min(A,B)+1 i B,K=map(int,input().split()) map(int,input().split()) B
A,B,K=map(int,input().split())
count=0
i=min(A,B)+1
while count<K:
    i-=1
    if A%i==0 and B%i==0:
        count+=1
print(i)