a, b, k = map(int, input().split())
count = 0

for i in range(1, min(a, b)+1)[::-1]:
    if a%i==0 and b%i==0:
        count += 1
    if count == k:
        print(i)
        exit() a, b, k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k count = 0 count 0 for i in range(1, min(a, b)+1)[::-1]:
    if a%i==0 and b%i==0:
        count += 1
    if count == k:
        print(i)
        exit() i range(1, min(a, b)+1)[::-1] (1, min(a, b)+1) range 1 min(a, b)+1 min(a, b) min a b 1 ::-1 -1 if a%i==0 and b%i==0:
        count += 1
     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)
        exit() count == k count k print(i) print i exit() exit count = 0 0 count count += 1 1 count k = map(int, input().split()) map(int, input().split()) k a, b, k = map(int, input().split()) map(int, input().split()) a b, k = map(int, input().split()) map(int, input().split()) b
a, b, k = map(int, input().split())
count = 0

for i in range(1, min(a, b)+1)[::-1]:
    if a%i==0 and b%i==0:
        count += 1
    if count == k:
        print(i)
        exit()
