a,b,k=map(int,input().split())
ii=1
ans=[]
while max(a,b)>=ii:
    if a%ii==0 and b%ii==0:
        ans.append(ii)
    ii+=1
print(ans[-k]) a,b,k=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k ii=1 ii 1 ans=[] ans [] while max(a,b)>=ii:
    if a%ii==0 and b%ii==0:
        ans.append(ii)
    ii+=1 max(a,b)>=ii max(a,b) max a b ii if a%ii==0 and b%ii==0:
        ans.append(ii)
     a%ii==0 and b%ii==0 a%ii==0 a%ii a ii 0 b%ii==0 b%ii b ii 0 ans.append(ii) ans.append ans append ii ii+=1 ii 1 print(ans[-k]) print ans[-k] ans -k k ii+=1 1 ii k=map(int,input().split()) map(int,input().split()) k ii=1 1 ii b,k=map(int,input().split()) map(int,input().split()) b a,b,k=map(int,input().split()) map(int,input().split()) a ans=[] [] ans
a,b,k=map(int,input().split())
ii=1
ans=[]
while max(a,b)>=ii:
    if a%ii==0 and b%ii==0:
        ans.append(ii)
    ii+=1
print(ans[-k])