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 = [0] * N
for i in range(N):
  S[i] = str(input())
  
S = sorted(S)
for i in range(N):
  print(S[i], end = "")

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

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

s_list_sorted = sorted(s_list)

for s_i in s_list_sorted:
    print(s_i,end = "")

Solution (Python):
import string

alph_list=list(string.ascii_lowercase)
mydict=dict(zip(alph_list,list(range(26))))
N, L=map(int,input().split())

def compare_str(s,t):
    for i in range(L):
        if mydict[s[i]]<mydict[t[i]]:
            return '<'
        elif mydict[s[i]]>mydict[t[i]]:
            return '>'
    return '='

def newlist(w,lst):
    l=len(lst)
    pos=0
    if l==0:
        return [w]
    while l>0:
        ineq=compare_str(lst[pos+l//2],w)
        if ineq=='<' or ineq=='=':
            pos=pos+l//2+1
            l=(l-1)//2
        else:
            l=l//2
    return lst[:pos] + [w] + lst[pos:]

mylist=[]
for _ in range(N):
    mylist=newlist(input(),mylist)

print(''.join(mylist))

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

Solution (Python):



import sys


def get_ints():
    return map(int, sys.stdin.readline().strip().split())


def input():
    return sys.stdin.readline().strip()


def _main():
    n, length = get_ints()
    s_list = [""] * n
    for i in range(n):
        s_list[i] = input()
    s = sorted(s_list)
    print("".join(s))


if __name__ == "__main__":
    _main()

Solution (Python):

import sys
input = sys.stdin.readline

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

Solution (Python):

n, l = map(int, input().split())
s = sorted(list(input() for _ in range(n)))

print("".join(s))

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

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

Solution (Python):
N, L = map(int,input().split())
S = []
a = ""
for i in range(N):
    a = input()
    S.append(a)
S = sorted(S)
s = ""
for i in range(N):
    s += S[i]
print(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=[input() for i in range(N)]
print(*sorted(S),sep="")

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

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

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

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

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

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())

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

S.sort()
print("".join(map(str,S)))

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

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

Solution (Python):
data = [int(i) for i in input().split(' ')]
N = data[0]
L = data[1]

s_list = []
for n in range(N):
    s = input()
    s_list.append(s)
    
s_list = sorted(s_list)
ans =''
for s in s_list:
    ans += s

print(ans)

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

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()
print(*s, sep="")

Solution (Python):
import sys


def getN():
    return int(input())


def getNM():
    return map(int, input().split())


def getList():
    return list(map(int, input().split()))


def input():
    return sys.stdin.readline().rstrip()






n, m = getNM()
ords = []
for _ in range(n):
    s = input()
    ords.append([[ord(x) for x in s]])
    ords[-1].append(s)

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

for _, s in ords:
    print(s, end='')

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

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

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

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

li.sort()

print(*li,sep="")

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

li.sort()

for j in range(N):
    s+=li[j]
print(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)]

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

Solution (Python):





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



t=[]


for k in range(s):
    t.append(input())

t.sort()

p=''

for j in t:
    p+=j

print(p)

Solution (Python):
n,l,*s=open(0).read().split();print("".join(sorted(s)))

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

print(*x,sep="")

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

ss.sort()
print("".join(ss))

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

Solution (Python):

n,l = map(int,input().split())
word_list=[]
for i in range(n):
    word = str(input())
    word_list.append(word)
x = sorted(word_list)
print(''.join(x))

Solution (Python):
import sys
input = sys.stdin.readline

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

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

print("".join(i for i in tmp))

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

inputs = [input() for i in range(int(N))]

inputs.sort()
result = "".join(inputs)
print(result)

Solution (Python):
a = input().split()
str_list = []
for i in range(int(a[0])):
  str_list.append(input())
print("".join(sorted(str_list)))

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

Solution (Python):
N,L = map(int,input().split())
S = sorted([input() for n 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()
sen=""
for i in range(n):
  sen=sen+s[i]
print(sen)

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

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

ara.sort()
for i in ara:
    print(i, end="")
print()

Solution (Python):


n, l = map(int, input().split())
s = []

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

s = sorted(s)

print(*s, sep='')

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

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

for i in range(n):
    word = input()
    list.append(word)

list_connect = "".join(sorted(list))


print(list_connect)

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

d.sort()

ans = ''

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

print(ans)

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

sum_ = ''
for s in S:
    sum_ += s

print(sum_)

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,numpy,string
from fractions import gcd
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) 
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())

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

    A.sort()
    print("".join(A))

if __name__ == '__main__':
    main()

Solution (Python):
N,L = map(int,input().split())
a=[]
for i in range(N):
  a.append(input())
a.sort()
print(''.join(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 = [input() for i in range(N)]

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

Solution (Python):
s = input().rstrip().split(" ")
t = []
for i in range(int(s[0])):
    t.append(input())
print("".join(sorted(t)))

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

S = sorted(S)

answer = "".join(S)

print(answer)

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

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

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

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

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

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

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

ans = sorted(res)
print(*ans, sep='')

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

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 = [input() for _ in range(N)]

t = ''.join(sorted(s))
print(t)

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

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 _ in range(n)]
s.sort()
print(''.join(s))

Solution (Python):

N,L=map(int,input().split())

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

print(''.join(a))

Solution (Python):

N,L=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_list = [input() for x in range(N)]

sorted_S_list = sorted(S_list)

result = str()
for s in sorted_S_list:
  result = result + s
  
print(result)

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

s_list = sorted(s_list)

ans_str = "".join(s_list)
print(ans_str)

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

for i in sorted(lis):
    print(i, end="")

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

str = ''
for i in range(len(lst)):
    str += lst[i]

print(str)

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

ss.sort()

ans = ""
for s in ss:
    ans += s

print(ans)

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

ss.sort()

ans = ""
for s in ss:
    ans += s

print(ans)

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

ss.sort()

ans = ""
for s in ss:
    ans += s

print(ans)

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

S=sorted(S)
ans=S[0]
for j in range(1,N):
    ans+=S[j]

print(ans)

Solution (Python):


N,L = map(int,input().split())


lst = []

for i in range(N):
    lst.append(str(input()))
lst.sort()    
fin = ''

for i in range(N):
    fin+=lst[i]
    
print(fin)

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

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

Solution (Python):
N,L = input().split()
txt = []
for i in range(int(N)):
    s = input()
    txt.append(s)
txt_sort = sorted(txt)
ts = ""
for i in range(int(N)):
    ts += txt_sort[i]
print(ts)

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 _ in range(N):
    S.append(input())





s_sorted = sorted(S)
print("".join(s_sorted))

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())
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("".join(s))

Solution (Python):
N , L = map(int,input().split())
Sls = []
for i in range(N):
    Sls.append(input())
Sls2 = sorted(Sls,key=str.lower)
moji = ''
for j in range(N):
    moji += Sls2[j]
print(moji)

Solution (Python):
n,l = (int(x) for x in input().split())

dict = []
for i in range(0,n):
    str = input()
    dict.append(str)
    

dict.sort()

print("".join(dict))

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

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

s = sorted(s)

print(''.join(s))

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


resolve()

Solution (Python):
n, l = input().split()
n = int(n)
lists = []
for s in range(0, n, 1):
  s = input()
  lists.append(s)

lists.sort()
print(''.join(lists))

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

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=sorted([input() for i 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()
for k in s:
  print(k, end ="")

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


a=[str(input()) for i in range(N)]

l_sort = sorted(a)

anser = "".join(l_sort)
print(anser)

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

Solution (Python):


LI = lambda: list(map(int, input().split()))


N, L = LI()
S = [input() for _ in range(N)]


def main():
    S.sort()
    print("".join(S))


if __name__ == "__main__":
    main()

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

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

Solution (Python):
import math
from collections import deque
from collections import defaultdict
import itertools as it


def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()
def factorization(n):
	res = []
	if n%2==0:
		res.append(2)
	for i in range(3,math.floor(n//2)+1,2):
		if n%i==0:
			c = 0
			for j in res:
				if i%j==0:
					c=1
			if c==0:
				res.append(i)
	if len(res)==0:
		res = [n]
	return res
def fact2(n):
	p = factorization(n)
	res = []
	for i in p:
		c=0
		z=n
		while 1:
			if z%i==0:
				c+=1
				z/=i
			else:
				break
		res.append([i,c])
	return res
def fact(n):
	ans = 1
	m=n
	for _i in range(n-1):
		ans*=m
		m-=1
	return ans
def comb(n,r):
	if n<r:
		return 0
	l = min(r,n-r)
	m=n
	u=1
	for _i in range(l):
		u*=m
		m-=1
	return u//fact(l)
def combmod(n,r,mod):
	return (fact(n)/fact(n-r)*pow(fact(r),mod-2,mod))%mod
def printQueue(q):
	r=copyQueue(q)
	ans=[0]*r.qsize()
	for i in range(r.qsize()-1,-1,-1):
		ans[i] = r.get()
	print(ans)
class UnionFind():
	def __init__(self, n):
		self.n = n
		self.parents = [-1]*n

	def find(self, x): 
		if self.parents[x]<0:
			return x
		else:
			self.parents[x] = self.find(self.parents[x])
			return self.parents[x]

	def union(self,x,y):
		x = self.find(x)
		y = self.find(y)

		if x==y:
			return

		if self.parents[x]>self.parents[y]:
			x,y = y,x

		self.parents[x]+=self.parents[y]
		self.parents[y]=x

	def size(self,x):
		return -1*self.parents[self.find(x)]

	def same(self,x,y):
		return self.find(x)==self.find(y)

	def members(self,x): 
		root = self.find(x)
		return [i for i in range(self.n) if self.find(i)==root]

	def roots(self):
		return [i for i,x in enumerate(self.parents) if x<0]

	def group_count(self):
		return len(self.roots())

	def all_group_members(self):
		return {r: self.members(r) for r in self.roots()} 
def bitArr(n):
	x = 1
	zero = "0"*n
	ans = []
	ans.append([0]*n)
	for i in range(2**n-1):
		ans.append(list(map(lambda x:int(x),list((zero+bin(x)[2:])[-1*n:]))))
		x+=1
	return ans;
def arrsSum(a1,a2):
	for i in range(len(a1)):
		a1[i]+=a2[i]
	return a1
def maxValue(a,b,v):
	v2 = v
	for i in range(v2,-1,-1):
		for j in range(v2//a+1): 
			k = i-a*j
			if k%b==0:
				return i
	return -1
def copyQueue(q):
	nq = queue.Queue()
	n = q.qsize()
	for i in range(n):
		x = q.get()
		q.put(x)
		nq.put(x)
	return nq
def get_sieve_of_eratosthenes(n):
	data = [2]
	
	for i in range(3,n+1,2):
		data.append(i)
		data.append(0)
	for i in range(len(data)):
		interval = data[i]
		if interval!=0:
			for j in range(i+interval,n-1,interval):
				data[j] = 0
	ans = [x for x in data if x!=0]
	
	return ans

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

s.sort()

print("".join(s))

Solution (Python):
a = list(map(int, input().split()))
b = [input() for i in range(a[0])]
c = sorted(b)
for f in c:
  print(f,end="")

Solution (Python):
import sys
import numpy as np
import random
from decimal import Decimal
import itertools
import re
import bisect
from collections import deque, Counter
from functools import lru_cache

sys.setrecursionlimit(10**9)
INF = 10**13
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
def SERIES(n): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ')
def GRID(h,w): return np.fromstring(sys.stdin.buffer.read(), dtype=np.int32, sep=' ').reshape(h,-1)[:,:w]
def GRIDfromString(h,w): return np.frombuffer(sys.stdin.buffer.read(), 'S1').reshape(h,-1)[:,:w]
MOD = 1000000007

def main():
	n, l = LI()
	s_list = SR(n)
	s_list.sort()
	ans = ''
	for s in s_list:
		ans += s
	print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
'''     
        
        
        

import sys
import math


def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())

def printspx(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")
def printchk(*args): return print(*args, end=" \ ")

MODPRIME = int(1e9+7); BABYMODPR = 998244353;

ONLINE_JUDGE = 1
if not ONLINE_JUDGE:
    sys.stdin = open("input.txt","r")  
    sys.stdout = open("output.txt","w")  
    sys.stderr = open("output.txt","w")  


import bisect
n, l = get_ints()
li = []
for i in range(n):
    s = input()
    bisect.insort(li, s)
print("".join(li))
'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS BY ME @luctivud ( UDIT GUPTA )
SOME PARTS OF THE CODE HAS BEEN TAKEN FROM WEBSITES LIKE::
(I Own the code if no link is provided here or I may have missed mentioning it)
DO NOT PLAGIARISE.
TESTCASES:
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Solution (Python):
N, L = list(map(int, input().strip().split()))
strl = [input().strip() for s in range(N)]
strl = sorted(strl)
s = ''
for t in strl:
  s += str(t)
print(s)

Solution (Python):
N, L = map(int, input().split())
s = []
for _ in range(N):
    var = input()
    s.append(var)
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())

strs = sorted([input() for i in range(n)])
print(''.join(strs))

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

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())

ss = []

for _ in range(n):
    ss.append(input())

ss.sort()

print(''.join(ss))

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 = []
for i in range(n):
    s.append(str(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):
num, len = map(int, input().split())

word_list = []

for n in range(0, num):
    word_list.append(input())

word_list.sort()

print("".join(word_list))

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()
print(''.join(s))

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 = []

for _ in range(n):
    s.append(str(input()))

print(''.join(sorted(s)))

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

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

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

word_list.sort()
ANS = "".join(word_list)
print(ANS)

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

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

s.sort()

print("".join(s))

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

for i in range(a[0]-1):
    for j in range(a[0]-1):
        if (b[a[0]-1-j]<b[a[0]-2-j]):
            temp=b[a[0]-j-1]
            b[a[0]-j-1]=b[a[0]-2-j]
            b[a[0]-2-j]=temp

for i in range(a[0]):
    print(b[i], end='')

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

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

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

strs.sort()
print(''.join(strs))

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

Solution (Python):
a1=input()
a2=a1.split(' ')
a3=[]
for i in range(2):
  a3.append(int(a2[i]))

b1=[] 
for i in range(a3[0]):
  b1.append(input())

b2=sorted(b1)

s=''
for i in range(a3[0]):
  s=s+b2[i]
  
print(s)

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

s.sort()

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

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

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

out=""
for i in lis:
  out+=i
  
print(out)

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

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

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

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

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

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

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

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

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

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

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

g = sorted(s)

print(''.join(g))

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

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

a = [[] * l for i in range(n)]
for i in range(n):
    I = input()
    for j in range(l):
        a[i].append(I[j])

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

ans = []
for i in range(n):
    ans.append("".join(b[i]))
print("".join(ans))

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 _ in range(N):
    S.append(input()) 

print("".join(sorted(S)))

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

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

print("".join(sorted(S)))

Solution (Python):
x=[int(i) for i in input().split()]
v=[]
for i in range(x[0]):
    string=str(input())
    v.append(string)
v.sort()
c=''
for ele in v:
    c+=ele
print(c)

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="")

Solution (Python):
N,L = map(int,input().split())
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 _ in range(N)]
S.sort()
print("".join(S))

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

ans = ""
arr = []

for i in range(0, N):
  temp = str(input())
  arr.append(temp)
arr = sorted(arr)

for i in range(0,N):
  ans = ans + arr[i]

print(ans)

Solution (Python):
def swap(s, t) :
  for i in range(L) : 
    if (s[i] < t[i]) : 
      return True
    elif (s[i] > t[i]) :
      return False
  return True

def strsort(s) : 
  for i in range(N) : 
    j = N - 1
    while j > i :
      if swap(s[j], s[j - 1]) : 
        tmp = s[j - 1]
        s[j - 1] = s[j]
        s[j] = tmp
      j -= 1


str = input()
lis = str.split(" ")
N = int(lis[0])
L = int(lis[1])
s = list()

for i in range(N) :
  s.append(input())
  
strsort(s)

print("".join(s))

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

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

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

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

word_list = []

for i in range(int(n[0])):
    word_list.append(input())

sorted_list = sorted(word_list)
answer = "".join(sorted_list)
print(answer)

Solution (Python):
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))



def read_a_int(): return int(read())


def read_ints(): return list(map(int, read().split()))


def read_col(H):
    '''H is number of rows
    A列、B列が与えられるようなとき
    ex1)A,B=read_col(H)    ex2) A,=read_col(H) 
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return tuple(map(list, zip(*ret)))


def read_tuple(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_matrix(H):
    '''H is number of rows'''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    


MOD = 10**9 + 7
INF = 2**31  

from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  


N, L = read_ints()
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(''.join(S))