#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, m;
  cin >> n >> m;
  vector<string> v(n);
  for (int i = 0; i < n; cin >> v[i++])
    ;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      bool ok = 0;
      for (int k = 0; k < m; k++)
        if (v[i][j] == v[i][k] && j != k) ok = 1;
      for (int k = 0; k < n; k++)
        if (v[i][j] == v[k][j] && i != k) ok = 1;
      if (!ok) s += v[i][j];
    }
  cout << s << endl;
}
