#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  char grid[n + 1][m + 1];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> grid[i][j];
  vector<char> v;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      char ch = grid[i][j];
      bool flag = true;
      for (int k = 1; k <= n; k++) {
        if (ch == grid[k][j] && k != i) {
          flag = false;
        }
      }
      for (int k = 1; k <= m; k++) {
        if (ch == grid[i][k] && k != j) {
          flag = false;
        }
      }
      if (flag) {
        v.push_back(ch);
      }
    }
  }
  for (int i = 0; i <= (int)(v.size() - 1); i++) cout << v[i];
  return 0;
}
