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