#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  char a[n][m + 1];
  for (int i = 0; i < n; i++) {
    scanf("%s", a[i]);
  }
  for (int row = 0; row < n; row++) {
    for (int col = 0; col < m; col++) {
      bool repeated = false;
      for (int i = 0; i < n; i++) {
        if (i == row) continue;
        if (a[row][col] == a[i][col]) {
          repeated = true;
          break;
        }
      }
      if (repeated) continue;
      for (int i = 0; i < m; i++) {
        if (i == col) continue;
        if (a[row][col] == a[row][i]) {
          repeated = true;
          break;
        }
      }
      if (!repeated) printf("%c", a[row][col]);
    }
  }
  cout << endl;
  return 0;
}
