#include <bits/stdc++.h>
using namespace std;
char a[101][101], b[101][101], c[101][101];
int i, n, m, k, j, f1, f2;
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) cin >> a[i][j];
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      f1 = f2 = 0;
      for (k = 1; k <= n; k++)
        if (a[i][j] == a[k][j] && i != k) {
          f1 = 1;
        }
      for (k = 1; k <= m; k++)
        if (a[i][j] == a[i][k] && k != j) {
          f2 = 1;
        }
      if (!f1 && !f2) cout << a[i][j];
    }
  cout << endl;
  return 0;
}
