#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 28;
const double INF = 1e12, EPS = 1e-9;
int n, m;
char in[100][101];
bool del[100][100];
void run() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> in[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) del[i][j] = 0;
  for (int i = 0; i < n; i++) {
    int cnt[26] = {};
    for (int j = 0; j < m; j++) cnt[in[i][j] - 'a']++;
    for (int j = 0; j < m; j++)
      if (cnt[in[i][j] - 'a'] > 1) del[i][j] = 1;
  }
  for (int i = 0; i < m; i++) {
    int cnt[26] = {};
    for (int j = 0; j < n; j++) cnt[in[j][i] - 'a']++;
    for (int j = 0; j < n; j++)
      if (cnt[in[j][i] - 'a'] > 1) del[j][i] = 1;
  }
  string ans;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (!del[i][j]) ans.push_back(in[i][j]);
  cout << ans << endl;
}
int main() { run(); }
