#include <bits/stdc++.h>
using namespace std;
int main() {
  long n, m;
  while (cin >> n >> m) {
    string s[10000], ss;
    long tt[10000] = {0}, kk[10000] = {0}, j, i, c;
    for (int i = 0; i < n; i++) cin >> s[i];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        c = 0;
        for (int k = 0; k < m; k++) {
          if (j != k && s[i][j] == s[i][k]) {
            c = 1;
            break;
          }
        }
        for (int k = 0; k < n; k++) {
          if (i != k && s[k][j] == s[i][j]) {
            c = 1;
            break;
          }
        }
        if (!c) ss += s[i][j];
      }
    }
    cout << ss << "\n";
  }
  return 0;
}
