#include <bits/stdc++.h>
using namespace std;
char s[101][101], ret[101 * 101];
bool vit[101][101];
int p[26], col[101][26];
int main() {
  int r, c, i, k, cnt = 0;
  scanf("%d %d\n", &r, &c);
  for (i = 0; i < r; i++) {
    scanf("%s", s[i]);
    memset(p, 0, sizeof(p));
    for (k = 0; k < c; k++) {
      p[s[i][k] - 'a']++;
      col[k][s[i][k] - 'a']++;
    }
    for (k = 0; k < c; k++)
      if (p[s[i][k] - 'a'] > 1) vit[i][k] = true;
  }
  for (i = 0; i < r; i++)
    for (k = 0; k < c; k++) {
      if (col[k][s[i][k] - 'a'] > 1) vit[i][k] = true;
      if (!vit[i][k]) ret[cnt++] = s[i][k];
    }
  ret[cnt] = '\0';
  printf("%s", ret);
  return 0;
}
