#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:200000000")
using namespace std;
char a[105][105];
int n, m;
bool u[105][105];
int main() {
  memset(u, false, sizeof(u));
  scanf("%d %d\n", &n, &m);
  for (int i = 0; i < n; i++, scanf("\n"))
    for (int j = 0; j < m; j++) scanf("%c", &a[i][j]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      for (int ix = 0; ix < m; ix++)
        if (ix != j && a[i][ix] == a[i][j]) u[i][ix] = u[i][j] = true;
      for (int ix = 0; ix < n; ix++)
        if (ix != i && a[ix][j] == a[i][j]) u[ix][j] = u[i][j] = true;
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (!u[i][j]) putchar(a[i][j]);
    }
  return 0;
}
