#include <bits/stdc++.h>
using namespace std;
using ll = long long;
bool removed[101][101];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  int n, m;
  cin >> n >> m;
  vector<string> grid(n);
  for (int i = 0; i < n; ++i) cin >> grid[i];
  for (int i = 0; i < n; ++i) {
    map<char, int> freq;
    for (int j = 0; j < m; ++j) {
      freq[grid[i][j]]++;
    }
    for (int j = 0; j < m; ++j) {
      if (0) cerr << freq[grid[i][j]] << ' ';
      if (freq[grid[i][j]] > 1) {
        removed[i][j] = true;
      }
    }
    if (0) cerr << "\n";
  }
  for (int j = 0; j < m; ++j) {
    map<char, int> freq;
    for (int i = 0; i < n; ++i) {
      freq[grid[i][j]]++;
    }
    for (int i = 0; i < n; ++i) {
      if (freq[grid[i][j]] > 1) {
        removed[i][j] = true;
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (!removed[i][j]) cout << grid[i][j];
    }
  }
  cout << "\n";
}
