#include <bits/stdc++.h>
using namespace std;
int diru[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dirv[] = {-1, 0, 1, -1, 1, -1, 0, 1};
char grid[1000][1000], ans[11000], ch;
int main() {
  int i, j, k, l, n, ret, count1, find, m;
  while (scanf("%d %d", &n, &m) == 2) {
    for (i = 0; i < n; i++) {
      scanf("%s", grid[i]);
    }
    l = 0;
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        ch = grid[i][j];
        find = 0;
        for (k = 0; k < n; k++) {
          if (k == i) continue;
          if (grid[k][j] == ch) {
            find = 1;
          }
        }
        for (k = 0; k < m; k++) {
          if (k == j) continue;
          if (grid[i][k] == ch) {
            find = 1;
          }
        }
        if (!find) ans[l++] = ch;
      }
    }
    ans[l] = '\0';
    puts(ans);
  }
  return 0;
}
