a, b, k = map(int, input().split())
CD = []
for i in range(a, 0, -1):
    if a % i == 0 and b % i == 0:
        CD.append(i)
print(CD[k - 1]) a, b, k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k CD = [] CD [] for i in range(a, 0, -1):
    if a % i == 0 and b % i == 0:
        CD.append(i) i range(a, 0, -1) range a 0 -1 if a % i == 0 and b % i == 0:
        CD.append(i) a % i == 0 and b % i == 0 a % i == 0 a % i a i 0 b % i == 0 b % i b i 0 CD.append(i) CD.append CD append i print(CD[k - 1]) print CD[k - 1] CD k - 1 k 1 a, b, k = map(int, input().split()) map(int, input().split()) a k = map(int, input().split()) map(int, input().split()) k b, k = map(int, input().split()) map(int, input().split()) b CD = [] [] CD
a, b, k = map(int, input().split())
CD = []
for i in range(a, 0, -1):
    if a % i == 0 and b % i == 0:
        CD.append(i)
print(CD[k - 1])