#include <bits/stdc++.h>
using namespace std;
const int MAXN = 101;
int n, m;
string s[MAXN];
int cnt[27];
bool toDel[MAXN][MAXN];
string solve() {
  for (int i = 0; i < n; i++) {
    memset(cnt, 0, sizeof(cnt));
    for (int j = 0; j < m; j++) cnt[s[i][j] - 'a']++;
    for (int j = 0; j < m; j++)
      if (cnt[s[i][j] - 'a'] > 1) toDel[i][j] = true;
  }
  for (int i = 0; i < m; i++) {
    memset(cnt, 0, sizeof(cnt));
    for (int j = 0; j < n; j++) cnt[s[j][i] - 'a']++;
    for (int j = 0; j < n; j++)
      if (cnt[s[j][i] - 'a'] > 1) toDel[j][i] = true;
  }
  string ans = "";
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (not toDel[i][j]) ans += s[i][j];
  return ans;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  cout << solve() << endl;
  return 0;
}
