#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int64_t n, m;
  cin >> n >> m;
  pair<char, int64_t> a[n][m];
  for (int64_t i = 0; i < n; ++i) {
    for (int64_t j = 0; j < m; ++j) {
      cin >> a[i][j].first;
      a[i][j].second = 0;
    }
  }
  for (int64_t i = 0; i < n; ++i) {
    for (int64_t j = 0; j < m; ++j) {
      int64_t c = 0;
      for (int64_t k = 0; k < n; ++k) c += a[k][j].first == a[i][j].first;
      if (c > 1) a[i][j].second = 1;
      c = 0;
      for (int64_t k = 0; k < m; ++k) c += a[i][j].first == a[i][k].first;
      if (c > 1) a[i][j].second = 1;
    }
  }
  for (int64_t i = 0; i < n; ++i) {
    for (int64_t j = 0; j < m; ++j) {
      if (a[i][j].second == 0) cout << a[i][j].first;
    }
  }
}
