A, B, K = map(int, input().split())

def make_div(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  return divisors

print(sorted(set(make_div(A))&set(make_div(B)), reverse=True)[K-1]) A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K def make_div(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  return divisors make_div divisors = [] divisors [] for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
   i range(1, int(n**0.5)+1) range 1 int(n**0.5)+1 int(n**0.5) int n**0.5 n 0.5 1 if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
   n % i == 0 n % i n i 0 divisors.append(i) divisors.append divisors append i if i != n // i:
        divisors.append(n//i)
   i != n // i i n // i n i divisors.append(n//i) divisors.append divisors append n//i n i return divisors divisors n n print(sorted(set(make_div(A))&set(make_div(B)), reverse=True)[K-1]) print sorted(set(make_div(A))&set(make_div(B)), reverse=True)[K-1] (set(make_div(A))&set(make_div(B)), reverse=True) sorted set(make_div(A))&set(make_div(B)) set(make_div(A)) set make_div(A) make_div A set(make_div(B)) set make_div(B) make_div B reverse=True reverse True K-1 K 1 B, K = map(int, input().split()) map(int, input().split()) B A, B, K = map(int, input().split()) map(int, input().split()) A K = map(int, input().split()) map(int, input().split()) K def make_div(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  return divisors def make_div(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  return divisors make_div
A, B, K = map(int, input().split())

def make_div(n):
  divisors = []
  for i in range(1, int(n**0.5)+1):
    if n % i == 0:
      divisors.append(i)
      if i != n // i:
        divisors.append(n//i)
  return divisors

print(sorted(set(make_div(A))&set(make_div(B)), reverse=True)[K-1])