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

if a > b:
    a, b = b, a

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

if a > b:
    a, b = b, a

for i in range(a, 0, -1):
    if a % i == 0 and b % i == 0:
        ans_list.append(i)
        if len(ans_list) == k:
            print(i)
            break
