#include <bits/stdc++.h>
using namespace std;
const int maxn = 101;
int n, m;
char a[maxn][maxn];
int col[maxn][30], row[maxn][30];
void enter() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", a[i]);
}
void solve() {
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < m; j++) {
      row[i][a[i][j] - 'a']++;
      col[j][a[i][j] - 'a']++;
    }
  string res;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < m; j++) {
      int d = a[i][j] - 'a';
      if (row[i][d] > 1 || col[j][d] > 1)
        a[i][j] = ' ';
      else
        res += a[i][j];
    }
  printf("%s", res.c_str());
}
int main() {
  enter();
  solve();
  return 0;
}
