#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n, i, j;
  string s;
  multiset<char> ms[250];
  vector<string> vs;
  cin >> m >> n;
  for (i = 0; i < m; i++) {
    cin >> s;
    vs.push_back(s);
    for (j = 0; j < n; j++) {
      ms[i].insert(s[j]);
      ms[m + j].insert(s[j]);
    }
  }
  s.clear();
  for (i = 0; i < m; i++)
    for (j = 0; j < n; j++) {
      if (ms[i].count(vs[i][j]) > 1 || ms[m + j].count(vs[i][j]) > 1) continue;
      s += vs[i][j];
    }
  cout << s << endl;
  return 0;
}
