x = list(map(int, input().split()))
l = []
for i in range(1, 101):
  if (x[0]%i) == 0 and (x[1]%i) == 0:
    l.append(i)
l.sort(reverse=True)
print(l[x[2]-1]) x = list(map(int, input().split())) x list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split l = [] l [] for i in range(1, 101):
  if (x[0]%i) == 0 and (x[1]%i) == 0:
    l.append(i) i range(1, 101) range 1 101 if (x[0]%i) == 0 and (x[1]%i) == 0:
    l.append(i) (x[0]%i) == 0 and (x[1]%i) == 0 (x[0]%i) == 0 x[0]%i x[0] x 0 i 0 (x[1]%i) == 0 x[1]%i x[1] x 1 i 0 l.append(i) l.append l append i l.sort(reverse=True) l.sort l sort reverse=True reverse True print(l[x[2]-1]) print l[x[2]-1] l x[2]-1 x[2] x 2 1 l = [] [] l x = list(map(int, input().split())) list(map(int, input().split())) x
x = list(map(int, input().split()))
l = []
for i in range(1, 101):
  if (x[0]%i) == 0 and (x[1]%i) == 0:
    l.append(i)
l.sort(reverse=True)
print(l[x[2]-1])