import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); PriorityQueue queue = new PriorityQueue<>(); while (0 < n--) { StringBuilder sb = new StringBuilder(sc.next()); sb.append('A'); queue.add(sb); } StringBuilder ans = new StringBuilder(); while (queue.size() > 0) { StringBuilder sb = queue.poll(); ans.append(sb.charAt(0)); sb.deleteCharAt(0); if (sb.length() > 1) { queue.add(sb); } } System.out.println(ans); } }