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