#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-5;
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  string str[N];
  for (int i = 0; i < N; i++) {
    cin >> str[i];
  }
  string ans = "";
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      char c = str[i][j];
      int flag = 1;
      for (int k = 0; k < N; k++) {
        if (k != i && c == str[k][j]) flag = 0;
      }
      for (int k = 0; k < M; k++) {
        if (k != j && c == str[i][k]) flag = 0;
      }
      if (flag == 1) {
        ans += string(1, c);
      }
    }
  }
  cout << ans << endl;
  return 0;
}
