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