#include <bits/stdc++.h>
using namespace std;
int arr[105][105];
int main() {
  int n, m;
  cin >> n >> m;
  string palabras[n];
  for (long long i = 0; i < (long long)n; i++) {
    cin >> palabras[i];
    string aux = palabras[i];
    for (long long j = 0; j < (long long)m - 1; j++) {
      int found = aux.find(aux[j], j + 1);
      if (found != -1) {
        arr[i][j] = 1;
        arr[i][found] = 1;
      }
    }
  }
  for (long long k = 0; k < (long long)m; k++) {
    string aux;
    for (long long i = 0; i < (long long)n; i++) {
      aux.push_back(palabras[i][k]);
    }
    for (long long j = 0; j < (long long)n - 1; j++) {
      int found = aux.find(aux[j], j + 1);
      if (found != -1) {
        arr[j][k] = 1;
        arr[found][k] = 1;
      }
    }
  }
  for (long long i = 0; i < (long long)n; i++) {
    for (long long j = 0; j < (long long)m; j++) {
      if (arr[i][j] == 0) {
        cout << palabras[i][j];
      }
    }
  }
  return 0;
}
