#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  char a[n][m];
  string s, A("a");
  int b[n][26], c[m][26];
  for (int i = 0; i < 26; ++i) {
    for (int j = 0; j < n; j++) b[j][i] = 0;
    for (int j = 0; j < m; j++) c[j][i] = 0;
  }
  for (int i = 0; i < n; ++i) {
    cin >> s;
    for (int j = 0; j < m; ++j) {
      a[i][j] = s[j];
      b[i][(int)s[j] - (int)A[0]]++;
      c[j][(int)s[j] - (int)A[0]]++;
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (b[i][(int)a[i][j] - (int)A[0]] == 1 &&
          c[j][(int)a[i][j] - (int)A[0]] == 1)
        cout << a[i][j];
    }
  }
  cout << endl;
  return 0;
}
