#include <bits/stdc++.h>
using namespace std;
int main() {
  char s[101][101];
  char tmp[101];
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) {
    scanf("%s", tmp);
    for (int j = 0; j < m; ++j) {
      s[i][j] = tmp[j];
    }
  }
  int count;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      count = 0;
      for (int u = 0; u < n; ++u)
        if ((i != u) && (s[u][j] == s[i][j])) {
          ++count;
        }
      for (int u = 0; u < m; ++u)
        if ((j != u) && (s[i][j] == s[i][u])) {
          ++count;
        }
      if (count == 0) printf("%c", s[i][j]);
    }
  return 0;
}
