#include <bits/stdc++.h>
int main() {
  int i, j, k, l, m, n, flagr, flagc, p1, p2, p3, p4;
  scanf("%d %d", &n, &m);
  getchar();
  char ch, c, str[110][110];
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      scanf("%c", &ch);
      str[i][j] = ch;
    }
    getchar();
  }
  for (i = 0; i < n; i++) {
    p1 = i;
    for (j = 0; j < m; j++) {
      p2 = j;
      flagr = 0;
      flagc = 0;
      c = str[i][j];
      for (k = 0; k < n; k++) {
        if (k != p1) {
          if (str[k][j] == c) {
            flagr = 1;
          }
        }
      }
      for (k = 0; k < m; k++) {
        if (p2 != k) {
          if (str[i][k] == c) {
            flagc = 1;
          }
        }
      }
      if (flagc == 0 && flagr == 0) {
        printf("%c", str[i][j]);
      }
    }
  }
  printf("\n");
  return 0;
}
