#include <bits/stdc++.h>
using namespace std;
char s[120][120];
int n, m;
int main() {
  int i, j, k, res = 30, now = 0;
  string ss = "";
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) scanf("%s", s[i]);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      char c = s[i][j];
      int f = 0;
      for (k = 0; k < n; k++) {
        if (i == k) continue;
        if (s[k][j] == c) f = 1;
      }
      for (k = 0; k < m; k++) {
        if (j == k) continue;
        if (s[i][k] == c) f = 1;
      }
      if (!f) ss += c;
    }
  }
  cout << ss << endl;
  return 0;
}
