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.



Sample input:
3 3
dxx
axx
cxx


Sample output:
axxcxxdxx

Submission status: Accepted

Solution code:
def resolve():
    N, L = list(map(int, input().split()))
    S_list = [input() for i in range(N)]
    print("".join(sorted(S_list)))

resolve()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
_, _, *s = open(0).read().split()
s.sort()
print(*s, sep="")

Submission status: Accepted

Solution code:
H, W = map(int, input().split())
S = []
for _ in range(H):
    S.append(input())

S.sort()
#print(S)
S_out=''
for ii in S:
  S_out += ii
print(S_out)

Submission status: Accepted

Solution code:
# n, m, l = map(int, input().split())

# list_n = list(map(int, input().split()))

# n = input()
# list = [input() for i in range(N)

# list = [[i for i in range(N)] for _ in range(M)]

import sys
input = sys.stdin.readline

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n, l = [int(x) for x in input().split()]
    a = []
    for _ in range(n):
        a.append(input())
    a.sort()
    print(''.join(a))



t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

a aa c ca c a b a ab a b c

"""

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 入力
N,L = list(map(int, input().split()))
S = []
for _ in range(N):
    S += [str(input())]

# 出力
print(''.join(sorted(S)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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 = "")

Submission status: Accepted

Solution code:
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 = "")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python
# -*- coding: UTF-8 -*-

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n, l = map(int, input().split())
s = sorted(list(input() for _ in range(n)))

print("".join(s))

Submission status: Accepted

Solution code:
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="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

s.sort()

for i in s:
    print(i,end="")

Submission status: Accepted

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

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

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

Submission status: Accepted

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

list=[] #空のリスト作成
for i in range(N):
  list.append(input()) #リスト追加
  
print("".join(sorted(list))) #昇順で結合

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()


#############
# Main Code #
#############

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

li.sort()

print(*li,sep="")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:





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)

Submission status: Accepted

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

Submission status: Accepted

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

print(*x,sep="")

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#B
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))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print("".join(S))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

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

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

s = sorted(s)

print(*s, sep='')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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_)

Submission status: Accepted

Solution code:
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())) # tupleも検討する。
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()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

S = sorted(S)

answer = "".join(S)

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC042B
N,L=map(int,input().split())

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

print(''.join(a))

Submission status: Accepted

Solution code:
# 入力
N,L=map(int,input().split())

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

# ソート
l.sort()

# 出力
print(''.join(l))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ss.sort()

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

#lst = list(map(int,input().split()))
N,L = map(int,input().split())
#print(N,L)

lst = []

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[2]:


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


# In[6]:


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


# In[ ]:

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print("".join(s))

Submission status: Accepted

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

Submission status: Accepted

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

dict = []
for i in range(0,n):
    str = input()
    dict.append(str)
    # print(i)
# print(dict)
dict.sort()
# print(dict)
print("".join(dict))

Submission status: Accepted

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

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

s = sorted(s)

print(''.join(s))

Submission status: Accepted

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


resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

l_sort = sorted(a)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!python3

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

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


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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
[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))

Submission status: Accepted

Solution code:
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): # root
		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): # much time
		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()} # 1~n
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): #j:aの個数
			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]
	#data = [0,0,0]
	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]
	#ans = data[:]
	return ans

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

s.sort()

print("".join(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
'''     ##     ##  #######  # #  ######
        ##     ##  ##   ##  ###    ##
        ##     ##  ##    #  # #    ##
        #########  #######  # #    ##    '''

import sys
import math
# sys.setrecursionlimit(10**6)

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")  # <<<  Comment this line  >>> #
    sys.stdout = open("output.txt","w")  # <<<  Comment this line  >>> #
    sys.stderr = open("output.txt","w")  # <<<  Comment this line  >>> #

# for _testcases_ in range(int(input())):
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 !!
'''

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N, L = map(int, input().split())
s = []
for _ in range(N):
    var = input()
    s.append(var)
s.sort()
print("".join(s))

Submission status: Accepted

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

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

s.sort()

print("".join(s))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

ss = []

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

ss.sort()

print(''.join(ss))

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
s = sorted(input() for i in range(n))
print(*s, sep = '')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

print(''.join(S))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

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

s.sort()

print("".join(s))

Submission status: Accepted

Solution code:
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='')

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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