def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a%b)
def make_divisors(n):
  lower_divisors , upper_divisors = [], []
  i = 1
  while i*i <= n:
    if n % i == 0:
      lower_divisors.append(i)
      if i != n // i:
        upper_divisors.append(n//i)
    i += 1
  return lower_divisors + upper_divisors[::-1]
A,B,K=map(int,input().split())
c=gcd(A,B)
print(make_divisors(c)[-K]) def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a%b) gcd if b == 0:
    return a
  else:
    return gcd(b, a%b) b == 0 b 0 return a a return gcd(b, a%b) gcd(b, a%b) gcd b a%b a b a a b b def make_divisors(n):
  lower_divisors , upper_divisors = [], []
  i = 1
  while i*i <= n:
    if n % i == 0:
      lower_divisors.append(i)
      if i != n // i:
        upper_divisors.append(n//i)
    i += 1
  return lower_divisors + upper_divisors[::-1] make_divisors lower_divisors , upper_divisors = [], [] lower_divisors [] upper_divisors [] i = 1 i 1 while i*i <= n:
    if n % i == 0:
      lower_divisors.append(i)
      if i != n // i:
        upper_divisors.append(n//i)
    i += 1
   i*i <= n i*i i i n if n % i == 0:
      lower_divisors.append(i)
      if i != n // i:
        upper_divisors.append(n//i)
     n % i == 0 n % i n i 0 lower_divisors.append(i) lower_divisors.append lower_divisors append i if i != n // i:
        upper_divisors.append(n//i)
     i != n // i i n // i n i upper_divisors.append(n//i) upper_divisors.append upper_divisors append n//i n i i += 1 i 1 return lower_divisors + upper_divisors[::-1] lower_divisors + upper_divisors[::-1] lower_divisors upper_divisors[::-1] upper_divisors ::-1 -1 n n A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K c=gcd(A,B) c gcd(A,B) gcd A B print(make_divisors(c)[-K]) print make_divisors(c)[-K] (c) make_divisors c -K K K=map(int,input().split()) map(int,input().split()) K def make_divisors(n):
  lower_divisors , upper_divisors = [], []
  i = 1
  while i*i <= n:
    if n % i == 0:
      lower_divisors.append(i)
      if i != n // i:
        upper_divisors.append(n//i)
    i += 1
  return lower_divisors + upper_divisors[::-1] def make_divisors(n):
  lower_divisors , upper_divisors = [], []
  i = 1
  while i*i <= n:
    if n % i == 0:
      lower_divisors.append(i)
      if i != n // i:
        upper_divisors.append(n//i)
    i += 1
  return lower_divisors + upper_divisors[::-1] make_divisors def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a%b) def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a%b) gcd A,B,K=map(int,input().split()) map(int,input().split()) A c=gcd(A,B) gcd(A,B) c B,K=map(int,input().split()) map(int,input().split()) B
def gcd(a, b):
  if b == 0:
    return a
  else:
    return gcd(b, a%b)
def make_divisors(n):
  lower_divisors , upper_divisors = [], []
  i = 1
  while i*i <= n:
    if n % i == 0:
      lower_divisors.append(i)
      if i != n // i:
        upper_divisors.append(n//i)
    i += 1
  return lower_divisors + upper_divisors[::-1]
A,B,K=map(int,input().split())
c=gcd(A,B)
print(make_divisors(c)[-K])