program k_th_common_divisor
  implicit none
  integer :: a, b, k, i, m = 0
  read(*,*) a, b, k
  do i = 100, 1, -1
    if (mod(a,i) == 0 .and. mod(b,i) == 0) m = m+1
    if (m == k) then
      write(*,'(i0)') i
      stop
    end if
  end do
end program k_th_common_divisor