#include <bits/stdc++.h>
using namespace std;
bool vis[30];
char ma[110][110];
int n, m;
bool Judge(int x, int y) {
  char c = ma[x][y];
  for (int i = 0; i < x; i++)
    if (ma[i][y] == c) return false;
  for (int i = x + 1; i < n; i++)
    if (ma[i][y] == c) return false;
  for (int j = 0; j < y; j++)
    if (ma[x][j] == c) return false;
  for (int j = y + 1; j < m; j++)
    if (ma[x][j] == c) return false;
  return true;
}
int main() {
  scanf("%d%d", &n, &m);
  memset(vis, false, sizeof(vis));
  for (int i = 0; i < n; i++) scanf("%s", ma[i]);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (Judge(i, j)) printf("%c", ma[i][j]);
    }
  }
  return 0;
}
