#include <bits/stdc++.h>
using namespace std;
int m, n, i, j;
char ch;
int num[10][200][200] = {0};
int a[200][200] = {0};
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      cin >> ch;
      a[i][j] = static_cast<int>(ch);
      num[1][i][a[i][j]]++;
    }
  for (j = 1; j <= m; j++)
    for (i = 1; i <= n; i++) {
      num[2][a[i][j]][j]++;
    }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      if (num[2][a[i][j]][j] + num[1][i][a[i][j]] == 2)
        cout << static_cast<char>(a[i][j]);
    }
  return 0;
}
