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

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

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