"use strict";

const fs = require("fs");

const lines = fs.readFileSync(0).toString().split("\n");
const data = lines[0].split(" ").map(x => Number(x));
const n = data[0];
const length = data[1];
const strs = lines.slice(1, 1 + n).map(s => s.substring(0, length));
process.stdout.write(strs.sort().join("") + "\n");
