#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  cin >> x >> y;
  char a[x][y];
  int b[27][y], c[x][27];
  memset(b, 0, sizeof b);
  memset(c, 0, sizeof c);
  for (int i = 0; i < x; i++)
    for (int j = 0; j < y; j++) {
      cin >> a[i][j];
      b[a[i][j] - 'a'][j]++;
      c[i][a[i][j] - 'a']++;
    }
  for (int i = 0; i < x; i++)
    for (int j = -0; j < y; j++) {
      if (b[a[i][j] - 'a'][j] == 1 && c[i][a[i][j] - 'a'] == 1) cout << a[i][j];
    }
  return 0;
}
