A, B, K = map(int, input().split())
n = min(A, B)
while K:
  if A % n == 0 and B % n == 0:
    K -= 1
  if K == 0:
    print(n)
  n -= 1 A, B, K = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B K n = min(A, B) n min(A, B) min A B while K:
  if A % n == 0 and B % n == 0:
    K -= 1
  if K == 0:
    print(n)
  n -= 1 K if A % n == 0 and B % n == 0:
    K -= 1
   A % n == 0 and B % n == 0 A % n == 0 A % n A n 0 B % n == 0 B % n B n 0 K -= 1 K 1 if K == 0:
    print(n)
   K == 0 K 0 print(n) print n n -= 1 n 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 -= 1 1 K K = map(int, input().split()) map(int, input().split()) K n = min(A, B) min(A, B) n n -= 1 1 n
A, B, K = map(int, input().split())
n = min(A, B)
while K:
  if A % n == 0 and B % n == 0:
    K -= 1
  if K == 0:
    print(n)
  n -= 1