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

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

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