#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  string s[n];
  for (long long i = 0; i < n; i++) {
    cin >> s[i];
  }
  vector<char> v;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      long long t = 0;
      for (long long k = 0; k < n; k++) {
        if (s[k][j] == s[i][j]) {
          t++;
        }
      }
      for (long long k = 0; k < m; k++) {
        if (s[i][k] == s[i][j]) {
          t++;
        }
      }
      if (t == 2) {
        v.push_back(s[i][j]);
      }
    }
  }
  for (auto x : v) cout << x;
  cout << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  ;
  long long testcases = 1;
  while (testcases--) {
    solve();
  }
  return 0;
}
