#include <bits/stdc++.h>
using namespace std;
int n, m;
int col[102][1002];
int row[102][1002];
char graph[102][102];
int visit[102][102];
string ss;
void solve() {
  ss.clear();
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      int p = graph[i][j] - 'a';
      if (col[j][p] > 1 || row[i][p] > 1) continue;
      ss += graph[i][j];
    }
  cout << ss << endl;
}
int main() {
  while (cin >> n >> m) {
    memset(visit, 0, sizeof(visit));
    memset(row, 0, sizeof(row));
    memset(col, 0, sizeof(col));
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) {
        cin >> graph[i][j];
        int t = graph[i][j] - 'a';
        col[j][t]++;
        row[i][t]++;
      }
    solve();
  }
  return 0;
}
