#include <bits/stdc++.h>
int main() {
  int i, j, k, l, m, n, f;
  char str[1000][1000];
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) scanf("%s", str[i]);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      f = 0;
      for (k = 0; k < m; k++) {
        if (k == j) continue;
        if (str[i][j] == str[i][k]) {
          f = 1;
          break;
        }
      }
      for (k = 0; k < n; k++) {
        if (k == i) continue;
        if (str[i][j] == str[k][j]) {
          f = 1;
          break;
        }
      }
      if (f == 0) printf("%c", str[i][j]);
    }
  }
  printf("\n");
  return 0;
}
