#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  char a[110][110];
  int i, j, k;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> a[i][j];
  int flag;
  for (i = 0; i < n; ++i) {
    for (j = 0; j < m; ++j) {
      flag = 1;
      for (k = 0; k < m; k++) {
        if (a[i][j] == a[i][k] && k != j) {
          flag = 0;
          break;
        }
      }
      if (flag != 0) {
        for (k = 0; k < n; k++) {
          if (a[i][j] == a[k][j] && k != i) {
            flag = 0;
            break;
          }
        }
      }
      if (flag) cout << a[i][j];
    }
  }
  cout << endl;
  return 0;
}
