import java.util.Scanner; public class Main { public static void main(String[] argv) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); String[] ss = new String[n]; for (int i = 0; i < n; ++i) { ss[i] = scanner.next(); } String res = ss[0]; for (int i = 1; i < n; ++i) { int len1 = res.length(); int len2 = ss[i].length(); String[][] dp = new String[len1 + 1][len2 + 1]; dp[0][0] = ""; for (int j = 0; j < len1 + 1; j++) { for (int k = 0; k < len2 + 1; k++) { if (j == 0 && k == 0) continue; String s1 = null; String s2 = null; if (k > 0) { s1 = dp[j][k - 1] + ss[i].charAt(k - 1); } if (j > 0) { s2 = dp[j - 1][k] + res.charAt(j - 1); } if (s1 == null) dp[j][k] = s2; else if (s2 == null) dp[j][k] = s1; else { if (s1.compareTo(s2) > 0) { // System.out.println(String.format("dp[%d][%d]=%s", j, k, s2)); dp[j][k] = s2; } else { // System.out.println(String.format("dp[%d][%d]=%s", j, k, s1)); dp[j][k] = s1; } } } } res = dp[len1][len2]; } System.out.println(res); } }