#include <bits/stdc++.h>
using namespace std;
int e[105][105];
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> s;
  for (int i = 0; i < (n); i++) {
    string t;
    cin >> t;
    for (int j = 0; j < (m); j++)
      for (int k = 0; k < (m); k++)
        if (j != k && t[j] == t[k]) {
          e[i][j] = 1;
          e[i][k] = 1;
        }
    s.push_back(t);
  }
  for (int j = 0; j < (m); j++)
    for (int i = 0; i < (n); i++)
      for (int k = 0; k < (n); k++)
        if (i != k && s[i][j] == s[k][j]) {
          e[i][j] = 1;
          e[k][j] = 1;
        }
  for (int i = 0; i < (n); i++)
    for (int j = 0; j < (m); j++)
      if (e[i][j] == 0) cout << s[i][j];
  return 0;
}
