#include <bits/stdc++.h>
using namespace std;
int x = 0, c;
int main() {
  int n, m;
  cin >> n >> m;
  char a[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      bool mi = false, ma = false;
      char ch = a[i][j];
      for (int x = 0; x < n; x++) {
        if (a[x][j] == ch && x != i) {
          mi = true;
          break;
        }
      }
      for (int x = 0; x < m; x++) {
        if (a[i][x] == ch && x != j) {
          ma = true;
          break;
        }
      }
      if (mi || ma) {
        continue;
      }
      cout << a[i][j];
    }
  }
  cout << endl;
}
