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.append(input())
s.sort()
for i in range(n):
    print(''.join(s[i]), end="")

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

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

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

list = []
for _ in range(N):
 i = str(input())
 list.append(i)


list_a = sorted(list)
 

mojiretu = ''.join(list_a)
 
print(mojiretu)

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

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

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

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

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

S.sort()

print("".join(S))

Solution (Python):
import sys

input = sys.stdin.readline


def ii():
    return int(input())


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


N, L = il()
print("".join(sorted([input()[:-1] for _ in range(N)])))

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

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

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):
n,l = map(int,input().split())
lst = [input() for _ in range(n)]
lst.sort()
print("".join(lst))

Solution (Python):
int_n, int_l = map(int, input().split())

li_s = list()

for i in range(int_n):
    li_s.append(input())

print("".join(sorted(li_s)))

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

A.sort()
B = "".join(A)

print(B)

Solution (Python):
import sys

lines = sys.stdin.readlines()

strings = []
for n, line in enumerate(lines):
  if n == 0:
    N, L = [int(_) for _ in line.strip().split(' ')]
    continue
  strings.append(line.strip())

def append(source, target):
  source = sorted(source)
  target.append(source[0])
  source.remove(source[0])
  if not len(source):
    return ''.join(target)
  return append(source, target)
  
print(append(strings, []))

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



import time
from contextlib import contextmanager

@contextmanager
def timer(title):
	t0 = time.time()
	yield
	print("{} - done in {:.0f}s".format(title,time.time()-t0) )

def  makeString(givenStringCount):
	givenStringsList = []
	lineRange = range(0,givenStringCount,+1)
	for i in lineRange:
		givenStringsList.append(input().strip())
	givenStringsSortedList = sorted(givenStringsList,reverse=False)
	smallString = "".join(givenStringsSortedList)
	answer = smallString
	return answer


if __name__ == '__main__':
	N,_ = map(int,input().strip().split(' '))

	solution=makeString(N)
	print("{}".format(solution))

Solution (Python):

s = input().split()
n = int(s[0])
list = []
for i in range(n):
    list.append(input())

list.sort()
for i in range(len(list)):
    print(list[i], end='')

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

Solution (Python):
N, L = [int(i) for i in input().split()]
S = [input().strip() 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):
n,l = map(int,input().split())
A = [input() for _ in range(n)]
A.sort()
ans = ''
for i in range(n):
    ans += A[i]
 
print(ans)

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

print(ans)

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

Solution (Python):
temp = input().rstrip().split(" ")
N = int(temp[0])
L = int(temp[1])
list1 = []
for i in range(N):
    list1.append(input().rstrip())
list1.sort()
ans = ""
for i in range(N):
    ans += list1[i]
print(ans)

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

S_num=[]
for i in range(N):
    s_num=""
    for alpha in S[i]:
        s_num+="{:0=2}".format(ord(alpha)-ord("a")+1)
    S_num.append([int(s_num),i])

S_num.sort()
S_sort=[str(s_num[0]) if len(str(s_num[0]))%2==0 else "0"+str(s_num[0]) for s_num in S_num]
S_num_sort="".join(S_sort)


S_num_2=[S_num_sort[i*2:i*2+2] for i in xrange(len(S_num_sort)/2)]

S_alpha=[chr(96+int(s_num_2)) for s_num_2 in S_num_2]
Ans="".join(S_alpha)

print Ans

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 i in range(N)]
c = 0
while c < N:
    for i in range(0, N-1-c):
        if S[i] > S[i+1]:
            S[i], S[i+1] = S[i+1], S[i]
    c += 1
print(''.join(S))

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

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

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

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

print(''.join(S))

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

Solution (Python):


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

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

print(ans)

Solution (Python):
if __name__ == '__main__':
    a, b = (int(i) for i in input().split())
    str_list = [input() for i in range(a)]

    print("".join(sorted(str_list)))

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

print("".join(sorted(literals)))

Solution (Python):
def main():
    n, _ = 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())

list=[input() for i in range(n)]
ans=""

list.sort()
for i in range(len(list)):
    ans = ans + list[i]
    
print(ans)

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

str_list.sort()

bonded_str = ''

for j in str_list:
    bonded_str += j

print(bonded_str)

Solution (Python):
import sys
t_list = []
for i in sys.stdin.readlines():
    t_list.append(i.rstrip())
t_list.pop(0)

def solution(t_list):
    t_list.sort()
    ans_str = ""
    for i in t_list:
        ans_str += i
    return ans_str
    
def main():
    print(solution(t_list))
    
if __name__ == '__main__':
    main()

Solution (Python):
def listToString(_list, split=""):
    maped_list = map(str, _list)  
    mojiretu = split.join(maped_list)
    return mojiretu


n, l = [int(i) for i in input().split()]
s = ["" for _ in range(n)]
for i in range(len(s)):
    s[i] = input()
s.sort()
print(listToString(s))

Solution (Python):
n, l = map(int, input().split())
s = sorted([input() for _ in range(n)], key=lambda x: ([x[i] for i in range(l)]))
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=[input() for i in range(N)]
S.sort()
ANS=""
for s in S:
    ANS+=s
print(ANS)

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

s_list.sort()
ans = ''
for i in range(N):
	ans = ans+s_list[i]

print(ans)

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

st_list = []

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

st_list.sort()

print("".join(st_list))

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

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

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

a.sort()

b=str(a)
b=b.replace(",","")
b=b.replace("[","")
b=b.replace("]","")
b=b.replace("'","")
b=b.replace(" ","")


print(b)

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):
    temp = input()
    s.append(temp)

s.sort()
for i in range(n):
    if i != n-1:
        print(s[i],end="")
    else:
        print(s[i])

Solution (Python):

n, l = map(int, input().split())
S = sorted([input() for _ in range(n)])

ans = ''

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

print(ans)

Solution (Python):
line = input().split(" ")
N = int(line[0])
L = int(line[1])

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

str = sorted(str)
for i in range(N):
    print(''.join(str[i]), end = '')

Solution (Python):
import sys

def solve(n, l, ls_s):
    sl = sorted(ls_s)
    s = ''
    for i in sl:
        s += i
    print(s)


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    n = int(ws[0])
    l = int(ws[1])
    ls_s = [sys.stdin.readline().strip().split()[0] for j in range(n)]
    return (n, l, ls_s,)

def main():
    solve(*readQuestion())

main()

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

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

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

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

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

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

Solution (Python):


import sys

def solve(n, l, ls_s):
    print(''.join(sorted(ls_s)))


def readQuestion():
    ws = sys.stdin.readline().strip().split()
    n = int(ws[0])
    l = int(ws[1])
    ls_s = [sys.stdin.readline().strip().split()[0] for j in range(n)]
    return (n, l, ls_s,)

def main():
    solve(*readQuestion())


main()

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

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

print("".join(c))

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

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

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

s.sort()

print("".join(s))

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

print("".join(sorted(l)))

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

ans = ""

while S:
    min_s = S[0]
    for si in S[1:]:
        min_s = min(si, min_s)
    ans += min_s
    S.remove(min_s)
print(ans)

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(1000000)



def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))



def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v



def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk



def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False



dp = None


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

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


main()

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

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

out_str = ""
_rm = words.remove
while True :
	min_word = min(words)
	out_str += min(words)
	_rm(min_word)
	
	if (len(words) == 0) :
		break;

print(out_str)

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

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

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

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

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

Solution (Python):
N,L=map(int,input().split())
Words=[input() for i in range(N)]
Words.sort(key=lambda x: x)
W=""
for w in Words:
  W+=w
print(W)

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

for i in range(N):
  b.append(a[i])
  
c = sorted(b)
print("".join(c))

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

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

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

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

l = []
i = 0

l = [input() for i in range(n)]
result = sorted(l)
s = ''.join(result)

print(s)

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

l = []
i = 0

l = [input() for i in range(n)]
result = sorted(l)
s = ''.join(result)

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())
l=[input() for i in range(n)]
l.sort()

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

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

for i in range(a[0]):
  c.append(b[i])
  
d = sorted(c)
print("".join(d))

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

Solution (Python):
n,l = (int(_) for _ in 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 = []
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())
list = []
for i in range(n):
    a = input()
    list.append(a)
print(''.join(sorted(list)))

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 S in range(N):
    S = str(input())
    s.append(S)
l = sorted(s)
m = "".join(l)
print(m)

Solution (Python):
data = list(map(int, input().split()))
strings = [input() for _ in range(data[0])]
strings.sort()
s = ''
for x in strings:
    s += x
print(s)

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

moji=[]

for i in range(0,N):
    moji.append(input())
    
moji=sorted(moji)
answer=""

for i in range(0,N):
    answer+=moji[i]
    
print(answer)

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

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

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

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

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

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

print("".join(S))

Solution (Python):


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

Solution (Python):
n, l = 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 = [input() for i in range(n)]
s.sort()
ans = ""
for i in s:
    ans += i
print(ans)

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

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 = sorted(s)
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 = map(int, input().split())
words = []
answer = ''

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

for i in range(len(words)):
    word = min(words)
    answer += word
    words.remove(word)

print(answer)

Solution (Python):


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

S = [input() for i in range(N)]
S = sorted(S)


len_list = [s_length == L for s_length in list(map(lambda s: len(s), S))]
S_concat = ""
if all(len_list):
  for i in range(len(S)):
    S_concat+=S[i]
  print(S_concat)

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

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


if __name__ == '__main__':
    main()

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

Solution (Python):
from sys import stdin


def main():
    n = next_int()
    l = next_int()

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

    print("".join(s))


def next_int():
    return int(next_str())


def next_str():
    result = ""
    while True:
        tmp = stdin.read(1)
        if tmp.strip() != "":
            result += tmp
        elif tmp != '\r':
            break
    return result


if __name__ == '__main__':
    main()

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

print(s)

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

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

print(ans)

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

ans=""
for j in range(N):
    ans=ans+list1[j]
print("".join(list1))

Solution (Python):
a = input().split(" ")
ar = []
for j in range(int(a[0])):
    l = input()
    ar.append(l)
b = sorted(ar)
print("".join(b))

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


if __name__ == "__main__":
    main()

Solution (Python):



"""
    1≦N,L≦100
    全ての i(1≦i≦N) に対し、Si の長さは L に等しい。
    各 i について, Si は全て半角英小文字のみから成る文字列である。
"""

test_mode = False

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

if test_mode:
    print(S)
S.sort()
if test_mode:
    print(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_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):

from sys import stdin

N, L = [int(x) for x in stdin.readline().rstrip().split()]
dic = []

for i in range(N):
    dic.append(stdin.readline().rstrip())
    
dic_sort = sorted(dic)
ans = "".join(dic_sort)

print(ans)

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

Solution (Python):
N, L = [int(x) for x in 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())
print("".join(sorted([input() for i in range(n)])))

Solution (Python):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


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


if __name__ == '__main__':
    main()

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

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

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

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

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

str_list = sorted(str_list)
ans_str = ''.join(str_list)
print(ans_str)

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

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

Solution (Python):
n,l = map(int,input().split())
a = []
for _ in [0]*n:
  a += [input()]
a.sort()
print("".join(a))

Solution (Python):
num, length = map(int, input().split(" "))
li = [input() for x in range(num)]
li_sort = []

def q_sort(li):
    left = []
    right = []
    if len(li) <= 1:
        return li
    
    ref = li[0]
    ref_count = 0

    for ele in li:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = q_sort(left)
    right = q_sort(right)
    return left + [ref] * ref_count + right
print("".join(q_sort(li)))

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

log.sort()
result = ''

for i in log:
    result += i

print(result)

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

s = []

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

s.sort()

ans = ""

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

print(ans)

Solution (Python):
n, l = map(int, input().split())
list_count = 0
list = []
while list_count < n:
  list.append(str(input()))
  list_count += 1
list.sort()
ans = ""
for letter in list:
  ans += letter
print(ans)

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

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

c = [0]*n
for i in range(n):
    c[i] = input()

c.sort()

print(*c,sep='')

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

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

print("".join(x))

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

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 = []
for i in range(n):
    s.append(input())
s.sort()
ans = ''
for i in s:
    ans += i
print(ans)

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

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

Solution (Python):
import sys
input()
print(''.join( sorted([x.rstrip() for x in sys.stdin.readlines()])))

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

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

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

orderd_inputs = sorted(inputs)

print(''.join(orderd_inputs))

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

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

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

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

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

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

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

for st in s_list:
    print(st,end='')

Solution (Python):
N, L = map(int, input().split())
S = ['']*N
for i in range(N):
    S[i] = 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):
n, l = map(int, input().split())
s = [input() for i in range(n)]
s.sort()
ans = ''
for i in range(n):
    print(s[i], end = '')
print()

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

Solution (Python):
n = int(raw_input().split()[0])
a = []
for i in range(n):
    a.append(raw_input())
a.sort()
ans = ''
for i in a:
    ans += i;
print ans

Solution (Python):
n = int(raw_input().split()[0])
a = []
for i in range(n):
    a.append(raw_input())
a.sort()
ans = ''
for i in a:
    ans += i;
print ans

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

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

solve()