#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long mod1 = 998244353;
const long long inf = 1e18;
const long long nax = 105;
long long n, m, row[nax][27], col[nax][27];
char grid[nax][nax];
void solve() {
  cin >> n >> m;
  for (long long i = (0); i < (n); i++)
    for (long long j = (0); j < (m); j++) {
      cin >> grid[i][j];
      row[i][grid[i][j] - 'a']++;
      col[j][grid[i][j] - 'a']++;
    }
  for (long long i = (0); i < (n); i++)
    for (long long j = (0); j < (m); j++)
      if (row[i][grid[i][j] - 'a'] == 1 && col[j][grid[i][j] - 'a'] == 1)
        cout << grid[i][j];
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
