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