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