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