#include <bits/stdc++.h>
using namespace std;
int main() {
  char grid[110][110];
  int n, m, i, j;
  memset(grid, '#', sizeof(grid));
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> grid[i];
  }
  bool rowVisible = false;
  bool colVisible = false;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      for (int q = 0; q < m; q++) {
        if (grid[i][q] == grid[i][j] && q != j) {
          rowVisible = true;
          break;
        } else
          rowVisible = false;
      }
      if (!rowVisible) {
        for (int r = 0; r < n; r++) {
          if (grid[r][j] == grid[i][j] && r != i) {
            colVisible = true;
            break;
          } else
            colVisible = false;
        }
      }
      if (!rowVisible && !colVisible) {
        cout << grid[i][j];
      }
    }
  }
  cout << endl;
  return 0;
}
