#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string a[n];
  vector<pair<int, int>> mp;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      bool flag1 = true;
      bool flag2 = true;
      char x = a[i][j];
      for (int k = i + 1; k < n; k++) {
        if (a[k][j] == x) {
          mp.push_back({k, j});
          flag1 = false;
        }
      }
      for (int t = j + 1; t < m; t++) {
        if (a[i][t] == x) {
          mp.push_back({i, t});
          flag2 = false;
        }
      }
      if (flag1 && flag2) {
        continue;
      } else {
        mp.push_back({i, j});
      }
    }
  }
  for (auto x : mp) {
    int i = x.first;
    int j = x.second;
    a[i][j] = '0';
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] != '0') {
        cout << a[i][j];
      }
    }
  }
}
