#include <bits/stdc++.h>
using namespace std;
void checkAndCrossOut(vector<string> &grid, vector<vector<int>> &destroyed,
                      int r, int c, int n, int m) {
  char curChar = grid[r][c];
  if (curChar == -1) return;
  bool existCopies = false;
  for (int row = 0; row < n; ++row) {
    if (grid[row][c] == -1) continue;
    if (grid[row][c] == curChar && row != r) {
      existCopies = true;
      destroyed[row][c] = -1;
    }
  }
  for (int col = 0; col < m; ++col) {
    if (grid[r][col] == -1) continue;
    if (grid[r][col] == curChar && col != c) {
      existCopies = true;
      destroyed[r][col] = -1;
    }
  }
  if (existCopies) destroyed[r][c] = -1;
}
int main() {
  int n, m;
  vector<string> grid;
  vector<vector<int>> destroyed;
  cin >> n >> m;
  string row;
  getline(cin, row);
  for (int i = 0; i < n; ++i) {
    getline(cin, row);
    grid.push_back(row);
    vector<int> add(m, 0);
    destroyed.push_back(vector<int>(m, 0));
  }
  for (int r = 0; r < n; ++r) {
    for (int c = 0; c < m; ++c) {
      checkAndCrossOut(grid, destroyed, r, c, n, m);
    }
  }
  for (int r = 0; r < n; ++r) {
    for (int c = 0; c < m; ++c) {
      if (destroyed[r][c] != -1) cout << grid[r][c];
    }
  }
  cout << endl;
  return 0;
}
