a, b, k = map(int ,input().split())
for i in range(100, 0, -1):
    if a % i == b % i == 0:
        k -= 1
        if k == 0:
            print(i)
            break a, b, k = map(int ,input().split()) a map(int ,input().split()) map int input().split() ().split () input split b k for i in range(100, 0, -1):
    if a % i == b % i == 0:
        k -= 1
        if k == 0:
            print(i)
            break i range(100, 0, -1) range 100 0 -1 if a % i == b % i == 0:
        k -= 1
        if k == 0:
            print(i)
            break a % i == b % i == 0 a % i == b % i a % i a i b % i b i 0 k -= 1 k 1 if k == 0:
            print(i)
            break k == 0 k 0 print(i) print i break b, k = map(int ,input().split()) map(int ,input().split()) b a, b, k = map(int ,input().split()) map(int ,input().split()) a k = map(int ,input().split()) map(int ,input().split()) k k -= 1 1 k
a, b, k = map(int ,input().split())
for i in range(100, 0, -1):
    if a % i == b % i == 0:
        k -= 1
        if k == 0:
            print(i)
            break
