#include <bits/stdc++.h>
char s[102][102];
bool vis[102][102];
int letter[26];
int n, m;
bool input() {
  int i, j;
  if (scanf("%d%d", &n, &m) == 2) {
    for (i = 0; i < n; i++) scanf("%s", s[i]);
    return true;
  } else
    return false;
}
void deal() {
  int i, j;
  for (i = 0; i < n; i++) {
    memset(letter, 0, sizeof(letter));
    for (j = 0; j < m; j++) letter[s[i][j] - 'a']++;
    for (j = 0; j < m; j++)
      if (letter[s[i][j] - 'a'] > 1) vis[i][j] = false;
  }
  for (j = 0; j < m; j++) {
    memset(letter, 0, sizeof(letter));
    for (i = 0; i < n; i++) letter[s[i][j] - 'a']++;
    for (i = 0; i < n; i++)
      if (letter[s[i][j] - 'a'] > 1) vis[i][j] = false;
  }
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      if (vis[i][j]) putchar(s[i][j]);
  putchar('\n');
}
int main(void) {
  while (input()) {
    memset(vis, true, sizeof(vis));
    deal();
  }
  return 0;
}
