#include <bits/stdc++.h>
using namespace std;
char letters[101][101];
int solve(int n1, int m1, int n, int m) {
  for (int j = 0; j < m; j++) {
    if (j == m1) {
      continue;
    } else if (letters[n1][m1] == letters[n1][j]) {
      return 0;
    }
  }
  for (int i = 0; i < n; i++) {
    if (i == n1) {
      continue;
    } else if (letters[n1][m1] == letters[i][m1]) {
      return 0;
    }
  }
  return 1;
}
int main() {
  int n, m;
  char res[10001];
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> letters[i][j];
    }
  }
  int k = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (solve(i, j, n, m)) {
        res[k] = letters[i][j];
        k++;
      }
    }
  }
  for (int i = 0; i < k; i++) {
    cout << res[i];
  }
  return 0;
}
