var a:array[0..1010]of string;
n,m,i,j:longint;
s:string;
procedure init;
begin
readln(n);
for i:=1 to n do readln(a[i]);
end;
procedure work;
begin
for i:=1 to n do
for j:=i+1 to n do if a[i]+a[j]<a[j]+a[i] then
begin
s:=a[i]; a[i]:=a[j]; a[j]:=s;
end;
for i:=1 to n do write(a[i]);
end;
begin
assign(input,'brick.in');reset(input);
assign(output,'brick.out');rewrite(output);
init;
work;
close(output);
end.