#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n;
  cin >> m;
  char t[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) cin >> t[i][j];
  }
  for (int a = 0; a < n; a++) {
    for (int b = 0; b < m; b++) {
      bool should_out = true;
      for (int c = 0; c < n; c++) {
        if (c != a) {
          if (t[a][b] == t[c][b]) should_out = false;
        }
      }
      for (int c = 0; c < m; c++) {
        if (c != b) {
          if (t[a][b] == t[a][c]) should_out = false;
        }
      }
      if (should_out) printf("%c", t[a][b]);
    }
  }
  return 0;
}
