#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m;
  cin >> n >> m;
  char arr[n][m];
  int arr1[n][m];
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      cin >> arr[i][j];
      arr1[i][j] = 0;
    }
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      char c = arr[i][j];
      for (long long int k = 0; k < n; k++) {
        if (k != i && c == arr[k][j]) {
          arr1[i][j] = 1;
        }
      }
      for (long long int k = 0; k < m; k++) {
        if (k != j && c == arr[i][k]) {
          arr1[i][j] = 1;
        }
      }
    }
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      if (arr1[i][j] == 1) {
        arr[i][j] = ' ';
      }
    }
  }
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      if (arr[i][j] != ' ') cout << arr[i][j];
    }
  }
}
