#include <bits/stdc++.h>
using namespace std;
const int maxn = 101;
const int maxm = 101;
char c[maxn][maxm];
int w[maxm][27], h[maxn][27];
int n, m;
int main() {
  scanf("%d%d\n", &n, &m);
  for (int i = 0, _n = (n); i < _n; i++) {
    for (int j = 0, _n = (m); j < _n; j++) {
      scanf("%c", &c[i][j]);
      h[i][c[i][j] - 'a']++;
      w[j][c[i][j] - 'a']++;
    }
    scanf("\n");
  }
  for (int i = 0, _n = (n); i < _n; i++)
    for (int j = 0, _n = (m); j < _n; j++)
      if (h[i][c[i][j] - 'a'] == 1 && w[j][c[i][j] - 'a'] == 1)
        printf("%c", c[i][j]);
  printf("\n");
  return 0;
}
