#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a, b, x, y, z, n, mx, mn, tmp;
  int cnt = 0, ans = 0;
  string s2 = "";
  vector<string> vc;
  map<char, int> mc;
  scanf("%d %d", &x, &y);
  char ch, ch2;
  for (int j = 0; j < x; j++) {
    string s = "";
    cin >> s;
    vc.push_back(s);
  }
  for (int j = 0; j < vc.size(); j++) {
    for (int k = 0; k < vc[j].size(); k++) {
      map<char, int> mc;
      map<pair<int, int>, int> mp;
      for (int w = 0; w < x; w++) {
        if (mp[{w, k}] == 0) {
          mc[vc[w][k]]++;
          mp[{w, k}]++;
        }
      }
      for (int w = 0; w < y; w++) {
        if (mp[{j, w}] == 0) {
          mc[vc[j][w]]++;
          mp[{j, w}]++;
        }
      }
      if (mc[vc[j][k]] == 1) {
        s2 += vc[j][k];
      }
    }
  }
  cout << s2 << "\n";
  return 0;
}
