#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  char arr[n][m];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> arr[i][j];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int foundrow = 0, foundcol = 0;
      for (int r = 0; r < n; r++) {
        if (arr[r][j] == arr[i][j] && i != r) foundcol = 1;
      }
      for (int c = 0; c < m; c++) {
        if (arr[i][j] == arr[i][c] && c != j) foundrow = 1;
      }
      if (foundcol == 0 && foundrow == 0) cout << arr[i][j];
    }
  }
  return 0;
}
