#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int n, m;
  cin >> n >> m;
  vector<vector<char> > grid(n, vector<char>(m));
  long long int i, j, k;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> grid[i][j];
    }
  }
  string ans = "";
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      bool flag = false;
      for (k = 0; k < m; k++) {
        if (k != j && grid[i][k] == grid[i][j]) {
          flag = true;
          break;
        }
      }
      if (flag == true) continue;
      for (k = 0; k < n; k++) {
        if (k != i && grid[k][j] == grid[i][j]) {
          flag = true;
          break;
        }
      }
      if (flag == false) ans += string(1, grid[i][j]);
    }
  }
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
