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