#include <bits/stdc++.h>
using namespace std;
void generateString(int arr[100][100], char str[100][100], int n, int m) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (arr[i][j] == 1) {
        cout << str[i][j];
      }
    }
  }
}
int checkString(int n, int m, char str[100][100], int i, int j) {
  for (int k = 0; k < n; k++) {
    if (str[k][j] == str[i][j] && k != i) return 1;
  }
  for (int k = 0; k < m; k++) {
    if (str[i][k] == str[i][j] && k != j) return 1;
  }
  return 0;
}
int main() {
  char str[100][100];
  int arr[100][100];
  int n, m;
  cin >> n;
  cin >> m;
  for (int i = 0; i < n; i++) {
    cin >> str[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (checkString(n, m, str, i, j)) {
        arr[i][j] = 0;
      } else {
        arr[i][j] = 1;
      }
    }
  }
  generateString(arr, str, n, m);
  return 0;
}
