#include <bits/stdc++.h>
using namespace std;
char mat[120][120];
bool mark[120][120];
int main(int argc, char** argv) {
  int n, m;
  while (2 == scanf("%d%d", &n, &m)) {
    for (int i = 0; i < n; ++i) {
      scanf("%s", mat[i]);
    }
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        for (int k = 0; k < n; ++k) {
          if (i == k) continue;
          if (mat[i][j] == mat[k][j]) {
            mark[i][j] = mark[k][j] = true;
          }
        }
        for (int k = 0; k < m; ++k) {
          if (j == k) continue;
          if (mat[i][j] == mat[i][k]) {
            mark[i][j] = mark[i][k] = true;
          }
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        if (!mark[i][j]) putchar(mat[i][j]);
      }
    }
    puts("");
    memset(mark, 0, sizeof mark);
  }
  return 0;
}
