#include <bits/stdc++.h>
using namespace std;
int main() {
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
  }
  int n, m;
  cin >> n >> m;
  vector<vector<char> > grid(n, vector<char>(m));
  vector<vector<int> > output(n, vector<int>(m, 0));
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> grid[i][j];
  for (int i = 0; i < n; i++) {
    vector<int> v(26, 0);
    for (int j = 0; j < m; j++) {
      v[grid[i][j] - 'a']++;
    }
    for (int j = 0; j < 26; j++) {
      if (v[j] > 1) {
        for (int k = 0; k < m; k++) {
          if (grid[i][k] == j + 'a') output[i][k] = -1;
        }
      }
    }
  }
  for (int i = 0; i < m; i++) {
    vector<int> v(26, 0);
    for (int j = 0; j < n; j++) {
      v[grid[j][i] - 'a']++;
    }
    for (int j = 0; j < 26; j++) {
      if (v[j] > 1) {
        for (int k = 0; k < n; k++) {
          if (grid[k][i] == j + 'a') output[k][i] = -1;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (output[i][j] != -1) cout << grid[i][j];
    }
  }
  return 0;
}
