A,B,K=map(int,input().split())
check = 0
res = 0
for i in range(100,0,-1):
  if A % i == 0 and B % i == 0:
    check += 1
    if check == K:
      res = i
      break
print(res) A,B,K=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B K check = 0 check 0 res = 0 res 0 for i in range(100,0,-1):
  if A % i == 0 and B % i == 0:
    check += 1
    if check == K:
      res = i
      break i range(100,0,-1) range 100 0 -1 if A % i == 0 and B % i == 0:
    check += 1
    if check == K:
      res = 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 check += 1 check 1 if check == K:
      res = i
      break check == K check K res = i res i break print(res) print res B,K=map(int,input().split()) map(int,input().split()) B res = 0 0 res res = i i res K=map(int,input().split()) map(int,input().split()) K check += 1 1 check check = 0 0 check A,B,K=map(int,input().split()) map(int,input().split()) A
A,B,K=map(int,input().split())
check = 0
res = 0
for i in range(100,0,-1):
  if A % i == 0 and B % i == 0:
    check += 1
    if check == K:
      res = i
      break
print(res)