A,B,K = map (int, input ().split ())
c = 0
if A < B:
  R = A
else:
  R = B
for i in range (R):
  I = R-i
  if A%I==0 and B%I==0:
    c += 1
    if c == K:
      print (I)
      break A,B,K = map (int, input ().split ()) A map (int, input ().split ()) map int input ().split () ().split () input split B K c = 0 c 0 if A < B:
  R = A
else:
  R = B A < B A B R = A R A R = B R B for i in range (R):
  I = R-i
  if A%I==0 and B%I==0:
    c += 1
    if c == K:
      print (I)
      break i range (R) range R I = R-i I R-i R i if A%I==0 and B%I==0:
    c += 1
    if c == K:
      print (I)
      break A%I==0 and B%I==0 A%I==0 A%I A I 0 B%I==0 B%I B I 0 c += 1 c 1 if c == K:
      print (I)
      break c == K c K print (I) print I break A,B,K = map (int, input ().split ()) map (int, input ().split ()) A B,K = map (int, input ().split ()) map (int, input ().split ()) B R = B B R c += 1 1 c R = A A R c = 0 0 c I = R-i R-i I K = map (int, input ().split ()) map (int, input ().split ()) K
A,B,K = map (int, input ().split ())
c = 0
if A < B:
  R = A
else:
  R = B
for i in range (R):
  I = R-i
  if A%I==0 and B%I==0:
    c += 1
    if c == K:
      print (I)
      break