var
a,b,c,d,e,n:longint;
qq:array[1..1000] of string;
procedure qsort(hd,lt:longint);
var
i,j:longint;
k,x:string;
begin
i:=hd;
j:=lt;
x:=qq[(i+j) div 2];
repeat
while qq[i]+x>x+qq[i] do inc(i);
while qq[j]+x<x+qq[j] do dec(j);
if j>=i then begin
k:=qq[i];
qq[i]:=qq[j];
qq[j]:=k;
inc(i);
dec(j);
end;
until i>j;
if i<lt then qsort(i,lt);
if j>hd then qsort(hd,j);
end;
begin
assign(input,'brick.in');
reset(input);
assign(output,'brick.out');
rewrite(output);
readln(n);
for a:=1 to n do
readln(qq[a]);
qsort(1,n);
for a:=1 to n do
write(qq[a]);
close(input);
close(output);
end.