package yukicoder150508; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] s = new String[n]; int len = 0; for (int i = 0; i < n; i++) { s[i] = sc.next(); len += s[i].length(); } StringBuffer ret = new StringBuffer(); for (int i = 0; i < len; i++) { String min = ""; int mini = -1; for (int j = 0; j < n; j++) { int sh = Math.min(min.length(), s[j].length()); int comp = min.substring(0, sh).compareTo(s[j].substring(0, sh)); if (comp == 0) { if (min.length() < s[j].length()) { min = s[j]; mini = j; } } else if (comp > 0){ min = s[j]; mini = j; } } ret.append(min.charAt(0)); s[mini] = s[mini].substring(1); } System.out.println(ret); sc.close(); } }