#include <bits/stdc++.h>
using namespace std;
const int maxn = 200 + 5;
char mat[maxn][maxn];
int ok[maxn][maxn];
int main() {
  int r, c;
  while (cin >> r >> c) {
    for (int i = 0; i < r; ++i) {
      scanf("%s", mat[i]);
    }
    for (int i = 0; i < r; ++i) {
      for (int j = 0; j < c; ++j) {
        int dump = false;
        for (int k = 0; k < r; ++k) {
          if (i == k) continue;
          if (mat[i][j] == mat[k][j]) {
            dump = true;
          }
        }
        for (int k = 0; k < c; ++k) {
          if (j == k) continue;
          if (mat[i][j] == mat[i][k]) {
            dump = true;
          }
        }
        if (!dump) {
          putchar(mat[i][j]);
        }
      }
    }
    puts("");
  }
}
