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