def euclidean(a,b):
  _ = a % b
  if _ == 0:
    return b
  else:
    while 1:
      if b % _ == 0 :
        break
      else:
        _ = b % _
    return _
  
A, B, K = map(int, input().split())
 
a = max(A, B)
b = min(A, B)
e = euclidean(a, b)
by = []
r = int(e ** (1 / 2))
 
for i in range(1, r + 1):
  if e % i == 0:
    by.append(i)
    j = e // i
    if j != i:
      by.append(j)
by.sort(reverse = True)
print(by[K - 1]) def euclidean(a,b):
  _ = a % b
  if _ == 0:
    return b
  else:
    while 1:
      if b % _ == 0 :
        break
      else:
        _ = b % _
    return _
   euclidean _ = a % b _ a % b a b if _ == 0:
    return b
  else:
    while 1:
      if b % _ == 0 :
        break
      else:
        _ = b % _
    return _
   _ == 0 _ 0 return b b while 1:
      if b % _ == 0 :
        break
      else:
        _ = b % _
     1 if b % _ == 0 :
        break
      else:
        _ = b % _
     b % _ == 0 b % _ b _ 0 break _ = b % _ _ b % _ b _ return _ _ 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 a = max(A, B) a max(A, B) max A B b = min(A, B) b min(A, B) min A B e = euclidean(a, b) e euclidean(a, b) euclidean a b by = [] by [] r = int(e ** (1 / 2)) r int(e ** (1 / 2)) int e ** (1 / 2) e 1 / 2 1 2 for i in range(1, r + 1):
  if e % i == 0:
    by.append(i)
    j = e // i
    if j != i:
      by.append(j) i range(1, r + 1) range 1 r + 1 r 1 if e % i == 0:
    by.append(i)
    j = e // i
    if j != i:
      by.append(j) e % i == 0 e % i e i 0 by.append(i) by.append by append i j = e // i j e // i e i if j != i:
      by.append(j) j != i j i by.append(j) by.append by append j by.sort(reverse = True) by.sort by sort reverse = True reverse True print(by[K - 1]) print by[K - 1] by K - 1 K 1 b = min(A, B) min(A, B) b A, B, K = map(int, input().split()) map(int, input().split()) A a = max(A, B) max(A, B) a def euclidean(a,b):
  _ = a % b
  if _ == 0:
    return b
  else:
    while 1:
      if b % _ == 0 :
        break
      else:
        _ = b % _
    return _
   def euclidean(a,b):
  _ = a % b
  if _ == 0:
    return b
  else:
    while 1:
      if b % _ == 0 :
        break
      else:
        _ = b % _
    return _
   euclidean K = map(int, input().split()) map(int, input().split()) K r = int(e ** (1 / 2)) int(e ** (1 / 2)) r e = euclidean(a, b) euclidean(a, b) e by = [] [] by j = e // i e // i j B, K = map(int, input().split()) map(int, input().split()) B
def euclidean(a,b):
  _ = a % b
  if _ == 0:
    return b
  else:
    while 1:
      if b % _ == 0 :
        break
      else:
        _ = b % _
    return _
  
A, B, K = map(int, input().split())
 
a = max(A, B)
b = min(A, B)
e = euclidean(a, b)
by = []
r = int(e ** (1 / 2))
 
for i in range(1, r + 1):
  if e % i == 0:
    by.append(i)
    j = e // i
    if j != i:
      by.append(j)
by.sort(reverse = True)
print(by[K - 1])