#include <bits/stdc++.h>
using namespace std;
int main() {
  ;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int N, M;
  cin >> N >> M;
  char matrix[101][101];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      cin >> matrix[i][j];
    }
  }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      bool milar = false, milac = false;
      char ch = matrix[i][j];
      for (int k = 0; k < N; k++) {
        if (matrix[k][j] == ch && k != i) {
          milar = true;
          break;
        }
      }
      for (int k = 0; k < M; k++) {
        if (matrix[i][k] == ch && k != j) {
          milac = true;
          break;
        }
      }
      if (milar || milac) {
        continue;
      }
      cout << matrix[i][j];
    }
  }
  cout << "\n";
  return 0;
}
