   program abc042b
      implicit none
      character(100),allocatable,dimension(:)::s
      integer::n,l
      integer::i
      
         read *, n,l
         allocate(s(n))
         do i=1,n
            read *, s(i)
         end do
         
         call sort_bubble(n,s)
         
         do i=1,n
            write(*,'(A)',advance='no') s(i)(1:l)
         end do
         stop
         
   contains         
      subroutine sort_bubble(n,arr)
       ! 最も直感的
       ! O(N^2)
       ! if want to sort the array of strings, change 't(int)' to 'w(character)'
         implicit none
         integer,intent(in)::n
         character(100),intent(inout)::arr(1:n)
         integer::i,j
         character(100)::t

            do i=1,n-1
               do j=i+1,n
                  if(arr(i) > arr(j))then
                     t=arr(i)
                     arr(i)=arr(j)
                     arr(j)=t
                  end if
               end do
            end do

            return
      end subroutine sort_bubble
      
   end program abc042b