#include <bits/stdc++.h>
using namespace std;
int main() {
  char a[200][200];
  int n, m, b[200][200] = {0};
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      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 k = j + 1; k < m; k++)
        if (a[i][j] == a[i][k]) {
          b[i][j] = 1;
          b[i][k] = 1;
        }
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (b[i][j] == 0) cout << a[i][j];
  return 0;
}
