#include <bits/stdc++.h>
int main() {
  int n, m;
  char c[128][128];
  char c1[128][128];
  char *c2;
  while (scanf("%d %d", &n, &m) != EOF) {
    int i = 0, j = 0, k = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        c1[i][j] = '1';
      }
    }
    for (i = 0; i < n; i++) {
      scanf("%s", c[i]);
    }
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        for (k = 0; k < m; k++) {
          if (c[i][j] == c[i][k] && j != k) {
            c1[i][j] = '0';
            c1[i][k] = '0';
          }
        }
      }
    }
    for (i = 0; i < m; i++) {
      for (j = 0; j < n; j++) {
        for (k = 0; k < n; k++) {
          if (c[j][i] == c[k][i] && j != k) {
            c1[j][i] = '0';
            c1[k][i] = '0';
          }
        }
      }
    }
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (c1[i][j] != '0') {
          printf("%c", c[i][j]);
        }
      }
    }
    printf("\n");
  }
  return 0;
}
