import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
public class Main {
public static Scanner sc = new Scanner(System.in);
public static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
public static long mod = (long)Math.pow(2,29);
public static void main(String[] args) throws Exception {
String nStr = reader.readLine();
int n = Integer.valueOf(nStr);
List<String> stringList = new ArrayList<>();
for(int i=0;i<n;i++){
String tmp = reader.readLine();
stringList.add(tmp);
}
System.out.println(getSmallRs(stringList, n));
}
static String getSmallRs(List<String> list, int n){
StringBuilder sb = new StringBuilder();
list.sort((a,b)->{
String s1 = a + b;
String s2 = b + a;
return s1.compareTo(s2);
});
for(int i=0;i<n;i++){
sb.append(list.get(i));
}
return sb.toString();
}
}
/*
2
abc
de
abcde
2
b
ba
bba
*/