#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  char vect[n][m];
  char s;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> vect[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int n2 = count(vect[i], vect[i] + m, vect[i][j]);
      int n3 = 0;
      for (int k = 0; k < n; k++) {
        if (vect[k][j] == vect[i][j]) n3 = n3 + 1;
      }
      if (n2 == 1 and n3 == 1) cout << vect[i][j];
    }
  }
}
