#include <bits/stdc++.h>
using namespace std;

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  for (string &e : S) {
    cin >> e;
  }
  sort(S.begin(), S.end());
  for (string e : S) {
    cout << e;
  }
}