#include <bits/stdc++.h>
using namespace std;
bool crossed[101][101];
string board[101];
bool toBeCrossed(int row, int col, int n, int m);
int main() {
  int n, m;
  cin >> n >> m;
  string result;
  for (int i = 0; i < (int)(n); i++) {
    cin >> board[i];
  }
  for (int i = 0; i < (int)(n); i++) {
    for (int j = 0; j < (int)(m); j++) {
      if (!crossed[i][j]) {
        bool test = toBeCrossed(i, j, n, m);
        if (!test) cout << board[i][j];
      }
    }
  }
  return 0;
}
bool toBeCrossed(int row, int col, int n, int m) {
  for (int i = 0; i < (int)(n); i++)
    if (i != row) {
      if (board[i][col] == board[row][col]) {
        crossed[i][col] = true;
        crossed[row][col] = true;
      }
    }
  for (int i = 0; i < (int)(m); i++)
    if (i != col) {
      if (board[row][i] == board[row][col]) {
        crossed[row][i] = true;
        crossed[row][col] = true;
      }
    }
  return crossed[row][col];
}
