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