#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  char letters[n][m + 1];
  for (int i = 0; i < n; i++) {
    cin >> letters[i];
  }
  bool yes[n][m];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) yes[i][j] = true;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < n; k++) {
        if (letters[i][j] == letters[k][j] && i != k) {
          yes[i][j] = false;
        }
      }
      for (int k = 0; k < m; k++) {
        if (letters[i][k] == letters[i][j] && j != k) {
          yes[i][j] = false;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (yes[i][j]) cout << letters[i][j];
    }
  }
}
