integer N
read*,N
do i=1,N-1
  do j=i+1,N
    do k=1,10
      if(BTEST(i,k-1)/=BTEST(j,k-1)then
        write(*,"(i0)",advance="no") k
        if(j/=N)write(*,"(A)",advance="no") " "
        exit
      endif
    end do
  end do
  write(*,*)
end do
end