a,b,k = map(int,input().split())
cnt = 0
ans = list()
for i in range(1,101):
  if a%i==0 and b%i==0:
    ans.append(i)

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

print(ans[::-1][k-1])