#include <bits/stdc++.h>
using namespace std;
char in[111][111];
int ck[111][111];
int n, m;
int rw[111][27], cl[111][27];
string ans;
int main() {
  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++) {
      rw[i][in[i][j] - 'a']++;
      cl[j][in[i][j] - 'a']++;
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (rw[i][in[i][j] - 'a'] == 1 && cl[j][in[i][j] - 'a'] == 1)
        ans += in[i][j];
  cout << ans;
  return 0;
}
