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 = [input() for i in range(N)]
S.sort()
S2 = []
for i in range(N):
    S2.append(S[i])
print(*(S2), sep='')

Solution (Python):
def compare_strings(s1, s2):
    if s1 < s2:
        return True
    return False

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

print(''.join(sorted(strings)))

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

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

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

s.sort()

print(''.join(s))

Solution (Python):
nl = list(map(lambda x: int(x), input().split(" ")))
n = nl[0]
l = nl[1]

strs = [input() for i in range(n)]

strs.sort()

print(''.join(strs))

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

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

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

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

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

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())
a = []
for _ in range(n):
    a.append(input())
a.sort()
print(''.join(a))

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

A.sort()

print(''.join(A))

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

s = [input() for _ in range(n)]
s.sort()

for string in s:
    print(string, end='')

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): 
    return list(map(int,input().split()))
def m(): 
    return map(int,input().split())
def onem(): 
    return int(input())
def s(x): 
    a = []
    if len(x) == 0:
        return []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): 
    return " ".join(map(str,x))
def max2(x): 
    return max(map(max,x))
def In(x,a): 
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
    ll = 0
    rr = r
    while True:
        mid = (ll+rr)//2

    if rr == mid:
        return ll
    if (ここに評価入れる):
        rr = mid
    else:
        ll = mid+1
"""

a,b = m()

data = []

ans = ""

for i in range(a):
    data.append(input()[:-1])
data.sort()

for i in range(a):
    ans += data[i]
print(ans)

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

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

Solution (Python):
N,L = map(int,input().split())
str_list=[]
final_str = ""
for i in range(N):
    str_list.append(input())
new_list = sorted(str_list)
for n in range(N):
    final_str += new_list[n]
print(final_str)

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

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

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

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

lis.sort()

print(''.join(lis))

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

S = sorted(S)
print(''.join(S))

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

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

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

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

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

Solution (Python):
s = [int(x) for x in input().split()]
s_list = []
for i in range(s[0]):
    s_list.append(input())

print(''.join(sorted(s_list)))

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

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

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

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

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

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

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

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

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

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

S.sort()
print(''.join(S))

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

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=[input()for i in range(n)]
print("".join(sorted(s)))

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

x = "".join(s)

print(x)

Solution (Python):



import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3 3
dxx
axx
cxx"""
        output = """axxcxxdxx"""
        self.assertIO(input, output)


def resolve():
    N, L = map(int, input().split())
    S = []
    for _ in range(N):
        S.append(input())
    S.sort()
    ans = ""
    for i in range(len(S)):
        ans += S.pop(0)
    print(ans)


if __name__ == "__main__":
    
    resolve()

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

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

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

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

print("".join(S))

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

S.sort()
[print(i,end='') for i in S]

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

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

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

	for _ in range(N):
		S.append(input())

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


  
if __name__ == "__main__":
  	main()

Solution (Python):
N, L = map(int, input().split())
 
C = [input() for i in range(N)]
 
C.sort()
 
i=0
 
while i < N:
    print(C[i] , end ="")
    i += 1

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

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

C = [input() for i in range(N)]

C.sort()

i=0

while i < N:
    print(C[i] , end ="")
    i += 1

Solution (Python):
x, y = map(int, input().split())
s = sorted([input () for i in range(x)])
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 = []
for i in range(N):
    S = input()
    A.append(S)
    
A = sorted(A)
ans = ''
for i in A:
    ans += i

print(ans)

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())
arr=[]
for i in range (N):
    a=input()
    arr.append(a)
arr.sort()
print("".join(arr))

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

ans = ""
for i in range(n):
    ans += sl[i]
print(ans)

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

string_list.sort()
for X in string_list:
  print(X, end="")

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

Solution (Python):
INP=list(map(int, input().split()))
N,L=INP[0],INP[1]
Slist=[]
for i in range(N):
  Slist.append(str(input()))
print("".join(sorted(Slist)))

Solution (Python):
def check(s1, s2):
    for i in range(len(s1)):
        if s1[i] < s2[i]:
            return s1
        elif s1[i] > s2[i]:
            return s2
    return s1
        

def s(a, l):
    for i in range(len(a)):
        m_step = 'z' * l
        ind = -1
        for j in range(i, len(a)):
            m_step = check(m_step, a[j])
            if m_step == a[j]:
                ind = j
        a[i], a[ind] = a[ind], a[i]
    return a
        
        
            

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

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

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

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

S.sort()

s1 = S[0]

for i in range(1,N):
  s1 += S[i]
  
print(s1)

Solution (Python):

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

    print(''.join(s))


if __name__ ==  "__main__":
    main()

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

Solution (Python):
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, l = inintm()

s = []

for _ 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)]

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):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

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

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

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

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

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

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

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

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

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

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

print(ans)

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

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

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

Solution (Python):
N,L=map(int,input().split())
X=[]*N
B=0
Ans=""
x=[]*N
s=[]*N
for i in range(N):
    X.append(input())
 
X.sort()

for i in range(N):
    Ans+=(X[i])

print(Ans)

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

word_list = []

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

answer = ''.join(sorted(word_list))
print(answer)

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

word_list = []

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

answer = ''.join(sorted(word_list))
print(answer)

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

Solution (Python):
N,L= map(int,input().split())
list=[]
for I in range(N):
    S=str(input())
    list.append(S)
list.sort()
c="".join(list)
print(c)

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

Solution (Python):

l,n = map(int, input().split())

s = [str(input()) for _ in range(l)]
s.sort()

print(''.join(s))

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

a=ans[0]
for i in range(n-1):
    a=a+ans[i+1]
print(a)

Solution (Python):
val = input()
splited_val = val.split()

val_list=[]

for x in range(int(splited_val[0])):
    val = input()
    val_list.append(val)

print("".join(sorted(val_list)))

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 = []
if n == 1:
  print(input())
  exit()
for i in range(n):
  a.append(input())
a.sort()
a = ''.join(a)
print(a)

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

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

slst = sorted(lst)
print("".join(slst))

Solution (Python):







n,l = map(int, input().split())

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

for i in range(1,l+1):
    strs.sort(key=lambda x:x[l-i])

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

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

Solution (Python):
first= input()
first = first.split()

N = int(first[0])
L =[]
for i in range(N):
  s = input()
  L.append(s)
  
L.sort()
for i in L:
  print(i,end="")

Solution (Python):
first = input()
first = first.split()

N = int(first[0])
L = []
for i in range(N):
  s = input()
  L.append(s)
  
L.sort()
for i in L:
  print(i,end="")

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

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

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

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

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

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

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 = []
for i in range(N):
    S.append(input())


list.sort(S)

ans = ''.join([str(i) for i in S])
    
print(ans)

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

s.sort()

l = ''.join([str(n) for n in s])

print(l)

Solution (Python):







N, L = map(int,input().split())
SRR = []

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


srr2 = sorted(SRR)


result = "".join(srr2)

print(result)

Solution (Python):







N, L = map(int,input().split())
SRR = []

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


srr2 = sorted(SRR)


result = "".join(srr2)

print(result)

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

Solution (Python):

def main():
    N, L = map(int,input().split())
    S = [input() for _ in range(N)]
    S.sort()
    for i in S:
        print(i, end = "")


if __name__ == '__main__':
    main()

Solution (Python):
def main():
    n, l = map(int, input().split())
    ss = [list(input()) for _ in range(n)]

    for i in range(l-1, -1, -1):
        ss = sorted(ss, key=lambda x: x[i])

    ans = ''
    for i in range(n):
        for j in range(l):
            ans += ss[i][j]
    print(ans)


if __name__ == "__main__":
    main()

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

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())
print("".join(sorted([input() for _ in range(n)])))

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

Solution (Python):
N = list(map(int, input().split()))
dic = []

for ins in range(N[0]):
  dic.append(input())

s = ""
for ins in sorted(dic):
  s += ins

print(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 = [input() for _ in range(N)]
S.sort()
for i in S:
    print(i, end = "")

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

Solution (Python):
from sys  import stdin,stdout

import bisect

import math

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")

def soe(limit):
    l=[1]*(limit+1)
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0

    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)
                
def gcd(a,b):
    while b:
        a=a%b
        b,a=a,b
    return a

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r
    
def solve():
    n,k=mp()
    l=[]
    for i in range(n):
        s=input()
        l.append(s)
    l.sort()
    print(''.join(l))
        

for _ in range(1):
    solve()

Solution (Python):
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, L = LI()
    S = [SS() for _ in range(N)]

    S.sort()
    print(''.join(S))

if __name__ == '__main__':
    resolve()

Solution (Python):
str_list = []
i = 1
n_number, l_length = map(int, input().split())
while i <= n_number:
    w_1 = input()
    str_list.append(w_1)
    i += 1


str_list.sort()
print(''.join(str_list))

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

print(''.join(S))

Solution (Python):
import math
import collections
import fractions
import itertools
import functools
import operator

def solve():
    n, l = map(int, input().split())
    s = [input() for _ in range(n)]
    for i in range(l):
        s.sort()
    print("".join(s))
    return 0

if __name__ == "__main__":
    solve()

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

val2.sort()
print("".join(val2))

Solution (Python):
def main():
    n,l=map(int,input().split(' '))
    li=[input() for i in range(n)]
    for i in range(n):
        print(min(li),end='')
        li.remove(min(li))

main()

Solution (Python):
FirstLine = input()
FirstLine = FirstLine.split()
L1 = []
for i in range(int(FirstLine[0])):
  s = input()
  L1.append(s)
L1.sort()
a = ""
for i in L1:
  a += i
 
print(a)

Solution (Python):
Firstline = input()
Firstline = Firstline.split()

List = []
for i in range(int(Firstline[0])):
  List.append(input())

List.sort()
s = ""
for i in List:
  s += i

print(s)

Solution (Python):
def resolve():
    N, L = map(int, input().split())
    S = []
    for _ in range(N):
        s = input()
        S.append(s)
    S = sorted(S)
    ans = ""
    for i in range(N):
        ans += S[i]
    print(ans)
resolve()

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

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())
A = []
for i in range(N):
	S = input()
	A.append(S)

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

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

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

def f(s, p=0):
    for i, c in enumerate("abcdefghijklmnopqrstuvwxyz"):
        if s[p] == c:
            if p == L - 1:
                return (i, )
            else:
                return (i, ) + f(s, p + 1)

print("".join([x[1] for x in sorted([(f(s), s) for s in S])]))

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

if __name__=="__main__":
  main()

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

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

print("".join(s))

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

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

S = []

for _ in range(N):
    s = input()
    S.append(s)

S.sort()

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

print()

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

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 = [input() for _ 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 _ in range(n)])
print(*s, sep='')

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 = list(input() for _ in range(n))
print(''.join(sorted(S)))