#include <bits/stdc++.h>
char s[105][105];
bool vis[105][105];
int n, m;
bool check(int x, int y) {
  for (int i = 0; i < n; i++)
    if (i != x && s[i][y] == s[x][y]) return 0;
  for (int i = 0; i < m; i++)
    if (i != y && s[x][i] == s[x][y]) return 0;
  return 1;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf(" %s", s[i]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (check(i, j)) printf("%c", s[i][j]);
  printf("\n");
}
