#include <bits/stdc++.h>
using namespace std;
const long long INF = 1000000000 + 7;
const double esp = 1e-13;
const double pi = 3.141592653589;
int n, m, f[100 + 10][100 + 10];
char a[100 + 10][100 + 10];
int main() {
  ios ::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = (1), _b = (n); i <= _b; i++)
    for (int j = (1), _b = (m); j <= _b; j++) cin >> a[i][j];
  memset(f, 0, sizeof(f));
  for (int i = (1), _b = (n); i <= _b; i++)
    for (int j = (1), _b = (m); j <= _b; j++) {
      for (int k = (1), _b = (m); k <= _b; k++)
        if (a[i][j] == a[i][k] && j != k) f[i][j] = 1, f[i][k] = 1;
      for (int k = (1), _b = (n); k <= _b; k++)
        if (a[i][j] == a[k][j] && i != k) f[i][j] = 1, f[k][j] = 1;
    }
  for (int i = (1), _b = (n); i <= _b; i++)
    for (int j = (1), _b = (m); j <= _b; j++)
      if (f[i][j] == 0) cout << a[i][j];
}
