Problem:
 Score : 200 points    Problem Statement Iroha has a sequence of N strings S_1, S_2, ..., S_N . The length of each string is L .  She will concatenate all of the strings in some order, to produce a long string.  Among all strings that she can produce in this way, find the lexicographically smallest one.  Here, a string s=s_1s_2s_3 ... s_n is lexicographically smaller than another string t=t_1t_2t_3 ... t_m if and only if one of the following holds:  There exists an index i(1≦i≦min(n,m)) , such that s_j = t_j for all indices j(1≦j<i) , and s_i<t_i .  s_i = t_i for all integers i(1≦i≦min(n,m)) , and n<m .       Constraints  1 ≦ N, L ≦ 100  For each i , the length of S_i equals L .  For each i , S_i consists of lowercase letters.         Input The input is given from Standard Input in the following format:  N  L  S_1  S_2 : S_N       Output Print the lexicographically smallest string that Iroha can produce.        Sample Input 1 3 3
dxx
axx
cxx      Sample Output 1 axxcxxdxx  The following order should be used: axx , cxx , dxx .

Solution (Python):
n, l = map(int, input().split())
s = []
for i in range(n):
    S = input()
    s.append(S)


import string
ALPHABETS = string.ascii_uppercase

def chars_to_int(chars):

    chars = chars.upper()
    size = len(chars)

    result = 0
    for pos, c in enumerate(chars):
        i = ALPHABETS.index(c) + 1
        exp = size - pos - 1
        result += i * 26 ** exp

    return result

a = []
for i in range(n):
    b = chars_to_int(s[i])
    a.append([b, s[i]])

a.sort(key=lambda x: x[0])

ans = ""
for i in range(n):
    ans += a[i][1]

print(ans)

Solution (Python):
N, L = map(int, input().split())
S = []
for _ in range(N):
    S.append(input())
    

S.sort()

print("".join(S))

Solution (Python):
N,L=[int(i) for i in input().split()]
S=[input() for i in range(N)]

S.sort()
for m in S:
	print(m,end="")
print()

Solution (Python):
N,L = map(int,input().split())
src = [input() for i in range(N)]
src.sort()
print(''.join(src))

Solution (Python):


def main():
    n, l = map(int, input().split())
    arry = [input() for _ in range(n)]
    arry.sort()
    print(''.join(arry))

if __name__ == '__main__':
    main()

Solution (Python):
n, l = map(int, input().split())
lst = [input() for _ in range(n)]
lst.sort()
print("".join(lst))

Solution (Python):
num,lengh = map(int,input().split())
lis = [input() for i in range(num)]
print("".join(sorted(lis)))

Solution (Python):
N, L = map(int, input().split())
S = [input() for i in range(N)]

S.sort()

print(''.join(S))

Solution (Python):

n,l = map(int,input().split())
s = []
for _ in range(n):
    s.append(input())
s.sort()
print(''.join(s))

Solution (Python):
N,L = map(int,input().split())
strList = []
for i in range(N):
    strList.append(input())
strList.sort()

for str in strList:
    print(str,end="")

Solution (Python):
n,l=map(int,input().split())
m=sorted([input() for _ in range(n)])
print("".join(m))

Solution (Python):
N, L = map(int, input().split())
S = [input() for i in range(N)]
for i in range(N):
    print(sorted(S)[i], end="")

Solution (Python):
def main():
    t = input().split(" ")
    N, L = int(t[0]), int(t[1])

    s = []
    for i in range(N):
        s.append(input())
    s.sort()
    print("".join(s))

main()

Solution (Python):
n, l = map(int, input().split())
s = list([input() for i in range(n)])
print("".join(sorted(s)))

Solution (Python):
N, L = map(int, input().split());print(''.join(sorted([input() for i in range(N)])))

Solution (Python):

def main():
    n, l = map(int,input().split())
    s =[]
    for i in range(n):
        s.append(input())


    print("".join(sorted(s)))

if __name__ == "__main__":
        main()

Solution (Python):

def main():
    n, l = map(int,input().split())
    s =[]
    for i in range(n):
        s.append(input())


    print("".join(sorted(s)))

if __name__ == "__main__":
        main()

Solution (Python):
N, L = map(int, input().split())
print(''.join(sorted([input() for i in range(N)])))

Solution (Python):
N, L = map(int, input().split())
S = sorted(input() for _ in range(N))
print(''.join(S))

Solution (Python):
N, L = map(int, input().split())
S = []
for i in range(N):
    S.append(input())
S.sort()
print(''.join(S))

Solution (Python):
n, l = map(int, input().split())
print("".join(sorted([input() for _ in range(n)])))

Solution (Python):
n,m=map(int,input().split())

k=[]

for i in range(n):
  s=input()
  k.append(s)
  
k.sort()

print(''.join(k))

Solution (Python):
n,l=map(int,input().split())
a=[]
for i in range(n):
    a+=list(input().split())
a.sort()
a=''.join(a)
print(a)

Solution (Python):
n, l = map(int, input().split(" "))
s = [input() for i in range(n)]

print("".join(sorted(s)))

Solution (Python):
n,l=map(int,input().split())
s=[]
for i in range(n):
  s.append(input())
print(''.join(sorted(s)))

Solution (Python):
n = list(map(int, input().split()))
a = []
for i in range(n[0]):
  a.append(input())

a.sort()

for i in range(n[0]):
  print(a[i], end="")
print()

Solution (Python):
N, L = [int(i) for i in input().split()]
sList = sorted([input() for _ in range(N)], key=lambda s: s)
s = ''.join(sList)
print(s)

Solution (Python):
N,  L = map(int,input().split()) 

L = []
for i in range(N):
    S = input()
    L.append(S)
    
sorted_L = sorted(L)
print("".join(sorted_L))

Solution (Python):
n , l = map(int, input().split())
s = []
for i in range(n):
    s.append(input())
s.sort()
for i in range(n):
    print(s[i],end = "")
print("")

Solution (Python):
N, L = map(int, input().split())
S = [input() for _ in range(N)]
S.sort()
ans = ""
for i in range(len(S)):
	ans += S[i]
print(ans)

Solution (Python):
N,L=map(int,input().split())
S=[]
for i in range(N):
  S.append(input())

S.sort()
for i in range(N):
  print(S[i],end="")

Solution (Python):
n,l=map(int,input().split())
ss=[input() for _ in range(n)]
ss=sorted(ss)
print(''.join(ss))

Solution (Python):
n, l = list(map(int, input().split()))
s = [input().strip() for i in range(n)]


ans = ''
for ss in sorted(s):
    ans += ss
print(ans)

Solution (Python):
N,L=map(int,input().split())
a=[]
for i in range(N):
    a.append(input())
a.sort()
s=""
for i in range(len(a)):
    s=s+a[i]
print(s)

Solution (Python):
N,L = map(int,input().split())
li = []

for i in range(N):
	li.append(input())

li.sort()

ans = ''

for s in li:
	ans = ans + s
	
print(ans)

Solution (Python):
n,m=map(int,input().split())
s=sorted([input() for i in range(n)])
print("".join(s))

Solution (Python):
n, l = map(int, raw_input().split())
s_list = []
for i in range(n):
  s_list.append(raw_input())

s_list.sort()

print(''.join(s_list))

Solution (Python):
n, l = [int(i) for i in input().split()]
s = [input() for i in range(n)]

s.sort()
print("".join(s))

Solution (Python):
N, L = list(map(int, input().split()))
word = []
for i in range(N):
	word.append(input())

word.sort()
print("".join(word))

Solution (Python):
n,l = map(int,input().split( ))

line = []

for i in range(n):
  line.append(str(input()))


line.sort()


print(''.join(line))

Solution (Python):
N,M=map(int,input().split())
s=[]
for i in range(N):
    s.append(input())
print("".join(sorted(s)))

Solution (Python):


n, l = map(int, input().split())
S = [input() for _ in range(n)]
S.sort()
print(''.join(S))

Solution (Python):
n,l = map(int, input().split())
s = []
for _ in range(n):
    s.append(input())
s.sort()
ans = ""
for i in s:
    ans += i
print(ans)

Solution (Python):
if __name__ == "__main__":
    n, l = [int(s) for s in input().split()]
    ss = sorted(input() for i in range(n))
    print("".join(ss))

Solution (Python):
print "".join(sorted([raw_input() for _ in xrange(int(raw_input().split()[0]))]))

Solution (Python):
n, l = (int(x) for x in raw_input().split())
print "".join(sorted([raw_input() for _ in xrange(n)]))

Solution (Python):
N, L = map(int,input().split())
S = []
for i in range(N):
    S.append(input())
    
S.sort()
s = ""
for i in range(N):
    s += S[i]

print (s)

Solution (Python):
n,l=map(int, input().split())
a=[input() for i in range(n)]
a.sort()
print(''.join(a))

Solution (Python):
n, l = (int(i) for i in input().split())
str_ary = [input() for i in range(n)]

str_ary = sorted(str_ary)
str_sorted = ""
for s in str_ary:
    str_sorted += s
print(str_sorted)

Solution (Python):


N, L = map(int, input().split())
str_list = [input() for i in range(N)]

str_list.sort()

ans = ""
for i in range(N):
    ans += str_list[i]

print(ans)

Solution (Python):
n,l = map(int,input().split())
S = list()

for i in range(n):
  S.append(input())
else:
  S.sort()
  print("".join(S))

"""
文字列もlist.sort()で並べ替えができるよ！！！
あとは、joinメソッドを使うか、

for i in range(len(S)):
    str_print = str_print + S[i]
else:
    print(str_print)

の方法があるよ！！！
"""

Solution (Python):
n,l = map(int,input().split())
S = list()

for i in range(n):
  S.append(input())
else:
  S.sort()
  print("".join(S))

Solution (Python):
n, l = map(int,input().split())
s = [input() for i in range(n)]
moji = ""
s_s = sorted(s)

for x in s_s:
    moji += x

print(moji)

Solution (Python):
n,m = map(int,input().split())
list = []
for i in range(n):
    list.append(input())
list.sort()
str=""
for i in range(n):
    str=str+list[i]
print(str)

Solution (Python):
n, l = list(map(int, input().split()))

wordlist = []
output_word = ""

for i in range(n):
  wordlist.append(input())

while wordlist:
  minimumword = wordlist[0]
  for i in range(len(wordlist)):
    minimumword = wordlist[i] if wordlist[i] < minimumword else minimumword

  output_word += minimumword
  del wordlist[wordlist.index(minimumword)]

print(output_word)

Solution (Python):
[n,l]=[int(i) for i in input().split()]
s=[input() for i in range(n)]
a=""
s.sort()
for j in range(len(s)):
    a=a+s[j]
print(a)

Solution (Python):
N,L = map(int,input().split())
S = []
for i in range(N):
  S.append(input())
print("".join(sorted(S)))

Solution (Python):
n, l = map(int, input().split())
s = [input() for _ in range(n)]
s.sort()
print("".join(s))

Solution (Python):
n, l = map(int, input().split())
s = []
for i in range(n):
    s.append(input())
s.sort()
print("".join(s))

Solution (Python):
N, L = map(int, input().split())

s = []
for i in range(N):
    s.append(input())

tmp2 = sorted(s)

ans = ""
for i in range(N):
    ans += tmp2[i]

print(ans)

Solution (Python):
N,L=map(int,raw_input().split())
s = [raw_input() for i in range(N)]
print ''.join(sorted(s))

Solution (Python):
N,L = map(int,input().split())
S = sorted([input() for _ in range(N)])
print(*S,sep='')

Solution (Python):
N, L = map(int, input().split())
S = sorted([input() for i in range(N)])

print(*S,sep="")

Solution (Python):
N,L = map(int, input().split())
S = [input() for i in range(N)]
S.sort()
s = ""
for i in range(N):
    s += S[i]
print(s)

Solution (Python):
n,l=map(int,input().split())
print(''.join(sorted([input() for _ in [0]*n])))

Solution (Python):
N, L = map(int, input().split())
S = sorted([input() for _ in range(N)])

res = ''
for i in range(N):
    res = res + S[i]
print(res)

Solution (Python):
n, l = map(int,input().split())
s = [input() for i in range(n)]
mj = sorted(s)
p = ""
for i in mj:
    p += i
print(p)

Solution (Python):
n, l = map(int,input().split())
s = [input() for _ in range(n)]
s.sort()
print(''.join(s))

Solution (Python):
n, l = map(int, input().split())
s=[]
for i in range(n):
  s.append(input())
s.sort()
print("".join(s))

Solution (Python):
n,l = map(int, input().split())
s = sorted([input() for i in range(n)])
print(''.join(s))

Solution (Python):
n, l = map(int, input().split())
a = sorted([input() for _ in range(n)])
print(''.join(a))

Solution (Python):
N, L=list(map(int, input().split()))
stringList = []
for i in range(N):
    stringList.append(input())

stringList.sort()
answer= ""
for i in range(N):
    answer = answer + stringList[i]
print(answer)

Solution (Python):
print(''.join(sorted(input()for _ in[0]*int(input().split()[0]))))

Solution (Python):
print("".join(sorted([input() for _ in range(int(input().split()[0]))])))

Solution (Python):
l = input().split(' ')

N = int(l[0])
L = int(l[1])
S=[]
for i in range(N):
    S.append(input())

S.sort()

for str in S:
    print(str,end="")

print()

Solution (Python):
print(''.join(sorted(input()for _ in[0]*int(input().split()[0]))))

Solution (Python):
n,l = (int(i) for i in input().split())
s = []
for i in range(n):
  s.append(input())
s.sort()
ans = ""
for i in range(n):
  ans = ans + s[i]
print(ans)

Solution (Python):
N,L = (int(i) for i in input().split())

S = []
for i in range(N):
    S.append(input())

S.sort(reverse =False)

ans = ""
for i in range(N):
    ans = ans + S[i]

print(ans)

Solution (Python):
n, l = map(int, input().split())

array = []
for i in range(n):
    array.append(input())
sort_array = sorted(array)
print("".join(sort_array))

Solution (Python):
ln_list = list(map(int, input().split()))
l = []
for list in range(ln_list[0]):
  l.append(input())
l.sort()
a = ''.join(l)
print(a)

Solution (Python):
n, l = map(int, input().split())
s = [input() for _ in range(n)]
s.sort()
print(''.join(s))

Solution (Python):



import sys
import os
import time
import re
from pydoc import help
import string
import math
import numpy as np
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools


sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]

def local_input():
    from pcm.utils import set_stdin
    import sys
    if len(sys.argv) == 1:
        set_stdin(os.path.dirname(__file__) + '/test/' + 'sample-1.in')

def solve():
    N, L = map(int, input().split())
    S = []
    for n in range(N):
        S.append(input())
    S.sort()
    print(''.join(S))

if __name__ == "__main__":
    try:
        local_input()
    except:
        pass
    solve()

Solution (Python):
N,L=map(int,input().split())
mojiretsu=[]
for i in range(N):
    mojiretsu.append(input())
    
mojiretsu.sort()
ans=''.join(mojiretsu)
print(ans)

Solution (Python):
n,l=map(int,input().split())
s=[input() for _ in range(n)]
s.sort()
a=''
for i in s:
    a=a+i
print(a)

Solution (Python):
n, l = list(map(int, input().split(' ')))
words = []
for _ in range(n):
    words.append(input())

print("".join(sorted(words)))

Solution (Python):
n, l = map(int, input().split())
S = [input() for i in range(n)]
print("".join(sorted(S)))

Solution (Python):
def main():
    n, l = map(int, input().split())
    
    s_lst = []
    for i in range(n):
        s_lst.append(input())
        
    s_lst.sort()
    
    print("".join(s_lst))
    
    
if __name__ == "__main__":
    main()

Solution (Python):
n,x=[int(i) for i in input().split()]
a=sorted([input().strip() for i in range(n)])

ans=""
for i in a:
  ans=ans+i
print(ans)

Solution (Python):
n , l = (int (i) for i in input().split())
text = [input() for i in range(n)]

text.sort()
print(''.join(text))

Solution (Python):
n, l = map(int, input().split())
a = sorted([input() for i in range(n)])
print(''.join(map(str, a)))

Solution (Python):
line = list(map(int,input().split()))
n,l = line[0],line[1]
s = []
for i in range(n):
    s.append(input())
s.sort()
print("".join(s))

Solution (Python):
n, l = map(int, input().split())
rec = []
for i in range(n):
    s = input()
    rec.append(s)
rec = sorted(rec)
t = ""
for i in range(n):
    t += rec[i]

print(t)

Solution (Python):
N, L = map(int, input().split())
S = [input() for i in range(N)]
S.sort()
A = ''
for i in S:
	A += i
print(A)

Solution (Python):
n,l = map(int,input().split())
dic = list()
ans=""

for i in range(n):
    dic.append(input())
    
dic = sorted(dic)

for word in dic:
    ans += word
    
print(ans)

Solution (Python):
N, L = map(int, input().split(' '))
string = []
for i in range(N):
    string.append(input())
print(''.join(sorted(string)))

Solution (Python):
n, k = map(int, input().split())
l = [input() for i in range(n)]
print(''.join(sorted(l)))

Solution (Python):
n, k = map(int, input().split())
l = [input() for i in range(n)]
l.sort()
print(''.join(l))

Solution (Python):
N, L=map(int, input().split())
S=[]
A=""
for i in range(N):
    S.append(input())
S.sort()
for i in range(N):
    A+=S[i]
print(A)

Solution (Python):
inn,gab = list(map(int,input().split()))
in1 = []
for i in range(inn):
  in1.append(input())
in1.sort()
r = ""
for i in range(inn):
  r+= in1[i]
print(r)

Solution (Python):
N,L = map(int,input().split())

S = []
for i in range(N):
    S.append(input())
    
print("".join(sorted(S)))

Solution (Python):
n, m = [int(i) for i in input().split()]
print (str().join(sorted([input() for i in range(n)])))

Solution (Python):
import math
import sys

def getinputdata():

    
    array_result = []
    
    data = input()

    
    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if(data != ""):
                
                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:


        return array_result

arr_data = getinputdata()

n = int(arr_data[0][0])
l = int(arr_data[0][1])

arr=[]

for i in range(1,1+n):
    
    arr.append(arr_data[i][0])
    
arr.sort()


print("".join(arr))

Solution (Python):
N, L = map(int,input().split())
S = list(input() for i in range(N))
S.sort()
ans = ''
for s in S:
    ans += s
print(ans)

Solution (Python):





if __name__ == '__main__':
    n, length = list(map(int, input().split()))
    s = sorted([input() for _ in range(n)])

    print(''.join(s))

Solution (Python):
inpt = map(int, raw_input().split())
lst = []

for i in range(0, inpt[0]):
	lst.append(raw_input())

lst.sort()

s = ''
for i in range(0, inpt[0]):
	s = s + lst[i]

print s

Solution (Python):
n, l = list(map(int,input().split()))
a = []
for i in range(n):
    a.append(input())
b = sorted(a)
c = b[0]
for i in range(1,n):
    c += b[i]
print(c)

Solution (Python):
n, l = list(map(int, input().split()))
s = []
for i in range(n):
    s.append(input())

s.sort()
sol = ""
for i in range(n):
    sol += s[i]
print(sol)

Solution (Python):


N = int(input().split()[0])

S_list = []

for row in range(N):
    S_list.append(input())
    
S_list = sorted(S_list)
print("".join(S_list))

Solution (Python):
N,L = map(int,input().split())
A = []
for i in range(N):
    A.append(input())
print("".join(sorted(A)))

Solution (Python):
N, L = map(int, input().split())
a = []
for i in range(N):
    a.append(input())
ans = ''
for i in sorted(a):
    ans += i
print(ans)

Solution (Python):
N,L = map(int,input().split())
S = ['']*N
for i in range(N):
    S[i] = input()
S.sort()
S_connect = "".join(S)
print(S_connect)

Solution (Python):
n,l = list(map(int, input().split(" ")))
s = []
for i in range(n):
  s.append(input())
s.sort()
print("".join(s))

Solution (Python):
n, l = map(int, input().split())
str_list = [input() for i in range(n)]

str_list.sort()

print("".join(str_list))

Solution (Python):
N,L=map(int,input().split())
S=[input() for i in range(N)]
S.sort()
T=""
for i in range(N):
    T+=S[i]
print(T)

Solution (Python):
import sys
import io


def run(input: io.TextIOBase, output: io.TextIOBase):
    nl = input.readline().split()
    n = int(nl[0])
    _ = int(nl[1])
    s = []
    for _ in range(0, n):
        s.append(input.readline().strip())
    s.sort()
    output.write("".join(s) + '\n')


if __name__ == '__main__':
    run(sys.stdin, sys.stdout)

Solution (Python):
n, l = map(int, input().split())
s = [input() for _ in range(n)]
s.sort()
print(''.join(s))

Solution (Python):
n,l = input().split()
n = int(n)
s = []
for i in range(n):
    s.append(input())
s.sort()
print("".join(s))

Solution (Python):
N, L = map(int, input().split())
S = [input() for _ in range(N)]
S.sort()
print(''.join(S))

Solution (Python):
n, l = map(int, input().split())
s = list(input().strip() for _ in range(n))
s_sorted = sorted(s)
print(''.join(s_sorted))

Solution (Python):
n, l = map(int, input().split())
sn = []
for a in range(n):
    sn.append(input())

sn.sort()
print(''.join(sn))

Solution (Python):
n,l = (int(i) for i in input().split())
s = [input() for i in range(n)]
s.sort()
answer = ""
for i in s:
	answer += i[:l]
print(answer)

Solution (Python):
N,L = map(int,input().split())
listA = [input() for i in range(N)]

listA = sorted(listA)
ans = "".join(listA)
print(ans)

Solution (Python):
N, L = map(int, input().split())
l = sorted([input() for i in range(N)])
print("".join(l))

Solution (Python):
N, L = map(int, input().split())
S = ["" for i in range(N)]
for i in range(N):
    S[i] = input()

S.sort()
result = ""
for i in range(N):
    result += S[i]
print(result)

Solution (Python):
n, l = map(int, input().split())


s = [[''] for i in range(n)]
for i in range(n):
    s[i] = input()

s.sort()
a = ''
for i in range(n):
    a+=s[i]

print(a)

Solution (Python):
n, l = map(int, input().split())


s = [[''] for i in range(n)]
for i in range(n):
    s[i] = input()

s.sort()
a = ''
for i in range(n):
    a+=s[i]

print(a)

Solution (Python):
n, _ = map(int, input().split())
words = sorted([input() for _ in range(n)])
print(''.join(words))

Solution (Python):
n,l=map(int,input().split())
list=[input() for i in range(n)]
list.sort()
ans=""
for word in list:
    ans+=word
print(ans)

Solution (Python):
n, l = map(int,input().split())
s = [str(input()) for i in range(n)]
s = sorted(s)
print("".join(s))

Solution (Python):
N,L=map(str,input().split())
line = []
for i in range(int(N)):
  tmp = input().rstrip()
  line.append(tmp)
line.sort()
result = ''.join(line)
print(result)

Solution (Python):
N, _ = [int(n) for n in input().split()]
S = []
for _ in range(N):
    S.append(input())

S = sorted(S)

print(''.join(S))

Solution (Python):
import sys

debug_mode = True if len(sys.argv) > 1 and sys.argv[1] == "-d" else False
if debug_mode:
    import os
    inf = open(os.path.basename(__file__).replace(".py", ".in"))

    def input():
        return inf.readline()
else:
    inf = sys.stdin



def main():
    n, l = [int(x) for x in input().split()]
    s = []
    for _ in range(n):
        s.append(input())

    s.sort()
    print("".join(s))


main()



if debug_mode:
    inf.close()

Solution (Python):
N,L=map(int,input().split())
A=[]
for i in range(N):
  s=input().strip()
  A.append(s)
A.sort()
ans=''.join(A)
print(ans)

Solution (Python):
N, L = map(int, input().split())
a = [input() for i in range(N)]
a.sort()
b = ""
for i in range(N):
 b += a[i]
print(b)

Solution (Python):
N, L = map(int, input().split())
a = [input() for i in range(N)]
a.sort()
b = ""
for i in range(N):
 b += a[i]
print(b)

Solution (Python):
import sys
N,L=map(int,input().split())
S=[]
for i in range(N):
    S.append(input())
S.sort()
outp=""
for i in range(N):
    outp+=S[i]
print(outp)

Solution (Python):
N,L=map(int,raw_input().split())
a=[ raw_input() for i in range(N)]
a.sort()
print "".join(a)

Solution (Python):
n, l = [int(i) for i in input().split()]
s = []
for i in range(n):
	s.append(input())
print(''.join(sorted(s)))

Solution (Python):
n,l=map(int,input().split())
s=[input() for i in range(n)]
s=sorted(s)
a=""
for i in range(n):
    a+=s[i]
print(a)

Solution (Python):
n, l = map(int, input().split())
ss = []
for i in range(n): ss.append(input())
print(''.join(sorted(ss)))

Solution (Python):
n, l = map(int, input().split())
print(''.join(list(sorted([input() for i in range(n)]))))

Solution (Python):
def main():
    N, L = map(int, input().split())
    S = [input() for _ in range(N)]

    ans = ""
    for s in sorted(S):
        ans += s
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N,L=map(int,input().split())
S=[input() for i in range(N)]

T=[]
for i in range(N):
    s=min(S)
    T.append(s)
    S.pop(S.index(s))

Ts=""
for i in range(len(T)):
    Ts+=T[i]

print(Ts)

Solution (Python):
import sys

N,L=map(int,input().split())
S=[input() for i in range(N)]

S.sort()
for j in range(N):
	sys.stdout.write(S[j])

print("")

Solution (Python):

"""
https://beta.atcoder.jp/contests/abc042/tasks/abc042_b

"""
import sys
from sys import stdin
input = stdin.readline


def solve(data):
    data.sort()
    return data


def main(args):
    N, L = map(int, input().split())
    data = [input().strip() for _ in range(N)]
    ans = solve(data)
    print(*ans, sep='')


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
n,l=map(int,input().split())
s=[input() for i in range(n)]
s.sort()
for i in range(n):
  print(s[i],end='')
print()

Solution (Python):
N,L = [int(i) for i in input().split()]
S=[input().strip() for j in range(N)]
print(''.join(sorted(S)))

Solution (Python):
print ''.join(sorted([raw_input() for _ in xrange(int(raw_input().split()[0]))]))

Solution (Python):
N, L = map(int,input().split())
P = [input() for _ in range(N)]
P.sort()
ans = str()
for i in range(N):
    ans += P[i]
print(ans)

Solution (Python):
n,l=map(int,input().split())
s=[]
for i in range(n):
    s.append(str(input()))
s=sorted(s)
for i in range(n):
    print(s[i],end='')

Solution (Python):
n, l = map(int, input().split())

s = []
for i in range(n):
   s.append(input())

s.sort()

print(''.join(s))

Solution (Python):
n, l = [int(x) for x in input().split()]
s = []
for _ in range(n):
    s.append(input())
print("".join(sorted(s)))

Solution (Python):
n,l=map(int,input().split())
s=[input() for i in range(n)]
print(''.join(sorted(s)))

Solution (Python):
N, L = map(int, input().split())
S = sorted([input() for i in range(N)])
print("".join(S))

Solution (Python):
n, l = map(int, input().split())

array = []
for i in range(n):
    array.append(input())
sort_array = sorted(array)
print("".join(sort_array))

Solution (Python):
N,L = map(int,input().split())
s = []
for n in range(N):
    s.append(input())
s = sorted(s)
print(''.join(s))

Solution (Python):
n,l=map(int,input().split())
s=[]
for i in range(n):
    s.append(input())
s.sort()
moji=""
for i in s:
    moji+=i
print(moji)

Solution (Python):
n=int(input().split()[0])
print("".join(sorted([input() for _ in [0]*n])))

Solution (Python):

if __name__ == '__main__':

    n, l = map(int,input().split())
    a = []
    for i in range(n) :
        a.append(input())

    a.sort()

    for i in range(n) :
        print(a[i], end="")

    print()

Solution (Python):
import sys
n, l = map(int, sys.stdin.readline().split())
words = []
for i in range(n):
    s = input()
    words.append(s)

words.sort()
print(''.join(words))

Solution (Python):
N,L = map(int,input().split())

lis = []



for i in range(N):
	a = input()
	lis.append(a)

lis.sort()
print(''.join(lis))

Solution (Python):
ri=(raw_input()).split(" ")
n=int(ri[0])
l=int(ri[1])
s=[""]*n
for i in range(n):
    s[i]=raw_input()

s=sorted(s)

r=""
for i in range(n):
    r+=s[i]

print(r)

Solution (Python):
N, L = map(int, input().split())
S = [input() for _ in range(N)]
print("".join(sorted(S)))

Solution (Python):
N, L = map(int, input().split())
S = [input() for _ in range(N)]
print("".join(sorted(S)))

Solution (Python):
def solve():
    N, L = list(map(int, input().split()))
    S_list = []
    ans = ""
    for i in range(N):
        S_list.append(input())
    S_list = sorted(S_list)
    for str in S_list:
        ans += str
    print(ans)

solve()

Solution (Python):
n, l = map(int, input().split())
li = []
for i in range(n):
  li.append(input())

print("".join(sorted(li)))

Solution (Python):
n,l = map(int,input().split())
s = sorted([input() for _ in range(n)])
print("".join(s))

Solution (Python):
n, l = list(map(int, input().split(" ")))
ss = []
for i in range(n):
    ss.append(input())
ans = ""
for i in sorted(ss):
    ans += i
print(ans)

Solution (Python):
N, L = [int(n) for n in input().split()]
S = []
for i in range(N):
  S.append(input())

S.sort()
print("".join(S))

Solution (Python):
n, l = map(int, input().split())
s = [input() for i in range(n)]

s.sort()
print(''.join(s))

Solution (Python):



"""042-b"""


from queue import PriorityQueue
import sys


def main():
    """Main function."""
    pq = PriorityQueue()
    N, L = map(int, sys.stdin.readline().split(' '))

    for l in range(N):
        pq.put(sys.stdin.readline()[:-1])

    while True:
        sys.stdout.write(pq.get())
        if pq.empty():
            break
    sys.stdout.write('\n')


if __name__ == '__main__':
    sys.exit(main())

Solution (Python):





def main():
    N, L = map(int, input().split())
    SS = [input() for _ in range(N)]

    SS.sort()
    print("".join(SS))

if __name__ == "__main__": main()

Solution (Python):
N, L = map(int, input().split())
S = []
for _ in range(N):
    S.append(input())
print(''.join(sorted(S)))

Solution (Python):
n,l = map(int,input().split())
arr = []

arr = [input() for i in range(n)]
arr.sort()
print("".join(arr))

Solution (Python):
nyuuryoku_num , _ = [int(i) for i in input().split()]

test_lists = [input() for i in range(nyuuryoku_num)]
print("".join(sorted(test_lists)))

Solution (Python):
a,b=(int(i) for i in input().split()) 
c=[]
for i in range(a):
  c.append(input())
c.sort()
d=""
for i in range(a):
  d=d+c[i][0:b]


print(d)

Solution (Python):
n=int(input().split()[0]);print(''.join(sorted([input()for _ in[0]*n])))

Solution (Python):
N, L = map(int, input().split())
array = []
for i in range(N):
    array.append(input())
sort = sorted(array)
for w in sort:
    print(w, end="")
print()

Solution (Python):
N, L = list(map(int, input().split()))
S = [input() for i in range(N)]
S.sort()
print(''.join(S))

Solution (Python):
N,L = list(map(int,input().split()))
memo = []
for i in range(N):
    memo.append(input())
memo.sort()
for j in range(N):
    print(memo[j],end="")

Solution (Python):
a,b=map(int,input().split())
S=[input() for i in range(a)]
S.sort()
print("".join(S))

Solution (Python):
n, l = map(int, raw_input().strip().split())
a = []
for x in xrange(n):
	a.append(raw_input().strip())
a.sort()
ans = ''
for x in a:
	ans += x
print(ans)

Solution (Python):
a=input().split()
N=int(a[0])
L=int(a[1])
S=[input() for i in range(N)]
S.sort()
ans=''.join(S)
print(ans)

Solution (Python):
N, L = map(int,input().split())
S = [input() for i in range(N)]

S.sort()


print("".join(S))

Solution (Python):
N, L = map(int, input().split())
S = [ input() for i in range(N)]
print(''.join(sorted(S)))

Solution (Python):
from collections import defaultdict


def main():
    N, L = map(int, input().split())
    S_list = [input() for _ in range(N)]
    print("".join(sorted(S_list)))


if __name__ == '__main__':
    main()

Solution (Python):
N, L = list(map(int, input().split(" ")))
S = []
for i in range(N):
    S.append(input())
    
S = sorted(S)  

ans = ""

for i in range(N):
    ans = ans + S[i]
    
print(ans)

Solution (Python):
n, l = map(int, input().split())
li = []
for i in range(n):
    s = input()
    li.append(s)

li.sort()
ans = "".join(map(str, li))
print(ans)

Solution (Python):
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))

n, l = rli()
s = []
for i in range(n):
    s.append(input())
s.sort()
print(pli(s))