#include <bits/stdc++.h>
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  char words[n][m];
  int bools[n][m];
  int i = 0, j = 0;
  for (i = 0; i < n; i++) {
    getchar();
    for (j = 0; j < m; j++) {
      bools[i][j] = 0;
      scanf("%c", &words[i][j]);
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      int flag = 0;
      if (bools[i][j] == 1) continue;
      char z = words[i][j];
      int c = 0;
      for (c = 0; c < n || c < m; c++) {
        if (c < n && words[c][j] == z && c != i) {
          bools[c][j] = 1;
          flag = 1;
        }
        if (c < m && words[i][c] == z && c != j) {
          bools[i][c] = 1;
          flag = 1;
        }
      }
      if (!flag) printf("%c", z);
    }
  }
  return 0;
}
