program test
implicit none
integer :: n,x(200000),y(200000),a(2),i,j,t

read(*,*) n
read(*,*) (x(i),i=1,n)

y = x

do i=1, n-1
  do j=i+1, n
    if(y(i) < y(j)) then
      t=y(i)
      y(i)=y(j)
      y(j)=t
    endif
  enddo
enddo

a(1) = y(n/2)
a(2) = y(n/2+1)

do i= 1, n
if (x(i) >= a(1)) then
  write(*,*) a(2)
  else
  write(*,*) a(1)
endif
enddo

end program