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

lim = min(A,B)

count = 0
for i in range(lim,0,-1):
  if A%i == 0 and B%i == 0:
    count += 1
    if count == K:
      print(i)
      break A,B,K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K lim = min(A,B) lim min(A,B) min A B count = 0 count 0 for i in range(lim,0,-1):
  if A%i == 0 and B%i == 0:
    count += 1
    if count == K:
      print(i)
      break i range(lim,0,-1) range lim 0 -1 if A%i == 0 and B%i == 0:
    count += 1
    if count == K:
      print(i)
      break A%i == 0 and B%i == 0 A%i == 0 A%i A i 0 B%i == 0 B%i B i 0 count += 1 count 1 if count == K:
      print(i)
      break count == K count K print(i) print i break K = map(int, input().split()) map(int, input().split()) K count += 1 1 count lim = min(A,B) min(A,B) lim A,B,K = map(int, input().split()) map(int, input().split()) A B,K = map(int, input().split()) map(int, input().split()) B count = 0 0 count
A,B,K = map(int, input().split())

lim = min(A,B)

count = 0
for i in range(lim,0,-1):
  if A%i == 0 and B%i == 0:
    count += 1
    if count == K:
      print(i)
      break