import sys
a,b,k = map(int,input().split())
tmp=[]
for i in range(1,min(a,b)+1):
    if a%i==0 and b%i==0:
        tmp.append(i)
print(tmp[-k])


 import sys sys a,b,k = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b k tmp=[] tmp [] for i in range(1,min(a,b)+1):
    if a%i==0 and b%i==0:
        tmp.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:
        tmp.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 tmp.append(i) tmp.append tmp append i print(tmp[-k]) print tmp[-k] tmp -k k a,b,k = map(int,input().split()) map(int,input().split()) a k = map(int,input().split()) map(int,input().split()) k b,k = map(int,input().split()) map(int,input().split()) b tmp=[] [] tmp
import sys
a,b,k = map(int,input().split())
tmp=[]
for i in range(1,min(a,b)+1):
    if a%i==0 and b%i==0:
        tmp.append(i)
print(tmp[-k])



