program answer
  implicit none

  integer :: A, B, C
  read(*,*) A, B, C

  if(A<C.and.C<B) then
     write(*,*) 'Yes'
  else if(B<C.and.C<A) then
     write(*,*) 'Yes'
  else
     write(*,*) 'No'
  end if

  stop
 end program answer
