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