A, B, K = map(int, input().split())
ans = []
for i in range(1, min(A, B) + 1):
    if A % i == 0 and 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 == 0 and 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 == 0 and B % i == 0:
        ans.append(i) A % i == 0 and B % i == 0 A % i == 0 A % i A i 0 B % i == 0 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 B, K = map(int, input().split()) map(int, input().split()) B K = map(int, input().split()) map(int, input().split()) K ans = [] [] ans
A, B, K = map(int, input().split())
ans = []
for i in range(1, min(A, B) + 1):
    if A % i == 0 and B % i == 0:
        ans.append(i)
ans.sort(reverse=True)
print(ans[K-1])