#include <bits/stdc++.h>
using namespace std;
char a[100][100];
bool b[100][100];
int n, m;
void pam(int ik, int jk, char c) {
  for (int i = 0; i < m; i++)
    if ((a[ik][i] == c) && (i != jk)) {
      b[ik][jk] = 0;
      b[ik][i] = 0;
    }
  for (int i = 0; i < n; i++)
    if ((a[i][jk] == c) && (i != ik)) b[i][jk] = 0, b[ik][jk] = 0;
}
int main() {
  memset(b, 1, sizeof(b));
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) pam(i, j, a[i][j]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (b[i][j] == 1) cout << a[i][j];
  return 0;
}
