#include <bits/stdc++.h>
using namespace std;
inline void pisz(int n) { printf("%d\n", n); }
template <typename T, typename TT>
ostream& operator<<(ostream& s, pair<T, TT> t) {
  return s << "(" << t.first << "," << t.second << ")";
}
template <typename T>
ostream& operator<<(ostream& s, vector<T> t) {
  for (int(i) = 0; (i) < (t.size()); ++(i)) s << t[i] << " ";
  return s;
}
string s[200], t[200];
int main() {
  int(n), (m);
  scanf("%d %d", &(n), &(m));
  for (int(i) = 0; (i) < (n); ++(i)) cin >> s[i];
  for (int(i) = 0; (i) < (n); ++(i))
    for (int(j) = 0; (j) < (m); ++(j)) {
      char c = s[i][j];
      bool ok = 1;
      for (int(i1) = 0; (i1) < (n); ++(i1))
        if (i1 != i && s[i1][j] == c) ok = 0;
      for (int(j1) = 0; (j1) < (m); ++(j1))
        if (j1 != j && s[i][j1] == c) ok = 0;
      if (ok) printf("%c", c);
    }
}
