a, b, k = map(int, input().split())
ans = []
for i in range(1, min(a, b)+1):
    if a % i == b % i == 0:
        ans.append(i)
ans.sort(reverse=True)
print(ans[k-1]) a, b, k = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b k ans = [] ans [] for i in range(1, min(a, b)+1):
    if a % i == b % i == 0:
        ans.append(i) i range(1, min(a, b)+1) range 1 min(a, b)+1 min(a, b) min a b 1 if a % i == b % i == 0:
        ans.append(i) a % i == b % i == 0 a % i == b % i a % i a i b % i b i 0 ans.append(i) ans.append ans append i ans.sort(reverse=True) ans.sort ans sort reverse=True reverse True print(ans[k-1]) print ans[k-1] ans k-1 k 1 a, b, k = map(int, input().split()) map(int, input().split()) a ans = [] [] ans k = map(int, input().split()) map(int, input().split()) k b, k = map(int, input().split()) map(int, input().split()) b
a, b, k = map(int, input().split())
ans = []
for i in range(1, min(a, b)+1):
    if a % i == b % i == 0:
        ans.append(i)
ans.sort(reverse=True)
print(ans[k-1])
