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