temp = []
l = []
a, b, k = map(int, input().split())

for i in range(1, a + 1):
    if a % i == 0:
        temp.append(i)

for i in range(1, b + 1):
    if b % i == 0 and i in temp:
        l.append(i)

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

for i in range(1, a + 1):
    if a % i == 0:
        temp.append(i)

for i in range(1, b + 1):
    if b % i == 0 and i in temp:
        l.append(i)

print(l[k * -1])