#include <bits/stdc++.h>
char Puz[105][105], ch;
bool flag[105][105], ok;
int i, j, k, n, m;
int main() {
  scanf("%d%d", &n, &m);
  scanf("%c", &ch);
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      scanf("%c", &ch);
      Puz[i][j] = ch;
    }
    scanf("%c", &ch);
  }
  memset(flag, 0, sizeof(flag));
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (!flag[i][j]) {
        ch = Puz[i][j];
        ok = true;
        for (k = 1; k <= n; k++)
          if (k != i && Puz[k][j] == ch) {
            ok = false;
            flag[k][j] = false;
          }
        for (k = 1; k <= m; k++)
          if (k != j && Puz[i][k] == ch) {
            ok = false;
            flag[i][k] = false;
          }
        flag[i][j] = ok;
      }
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (flag[i][j]) printf("%c", Puz[i][j]);
  printf("\n");
}
