#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-8;
const int inf = 1e9;
inline void STDIO() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
int main() {
  int n, m;
  string s[100];
  cin >> n >> m;
  for (int i = 0; i < n; ++i) cin >> s[i];
  bool a[105][105] = {};
  int k;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      k = 0;
      for (int l = 0; l < m; ++l)
        if (s[i][j] == s[i][l]) ++k;
      if (k > 1) a[i][j] = 1;
    }
  for (int i = 0; i < m; ++i)
    for (int j = 0; j < n; ++j) {
      k = 0;
      for (int l = 0; l < n; ++l)
        if (s[j][i] == s[l][i]) ++k;
      if (k > 1) a[j][i] = 1;
    }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      if (!a[i][j]) cout << s[i][j];
  cout << '\n';
}
