#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, y = 0, c;
  cin >> n >> m;
  c = n;
  string s, t;
  char w;
  while (c--) {
    cin >> t;
    s += t + "\n";
  }
  t = s;
  for (int i = 0; i < s.size() - 1; i++) {
    w = s[i];
    y = i + 1;
    while (s[y] != '\n') {
      if (w == s[y]) {
        s[i] = '{';
        s[y] = '{';
      }
      y++;
    }
    if (s[y] == '\n' && y != s.size() - 1) {
      y++;
    }
  }
  for (int i = 0; i < m; i++) {
    for (int z = i; z < t.size() - (m + 1); z += m + 1) {
      w = t[z];
      for (int x = z + m + 1; x < t.size(); x += m + 1) {
        if (t[x] == w) {
          t[x] = '{';
          t[z] = '{';
        }
      }
    }
  }
  for (int i = 0; i < s.size(); i++) {
    if (s[i] != '{' && t[i] != '{' && s[i] != '\n') {
      cout << s[i];
    }
  }
  return 0;
}
