#include <bits/stdc++.h>
using namespace std;
char st[105][105];
int a[30];
int b[105][105];
int main() {
  int n, m, i, j;
  scanf("%d%d", &n, &m);
  gets(st[0]);
  for (i = 0; i < n; ++i) gets(st[i]);
  for (i = 0; i < n; ++i) {
    memset(a, 0, sizeof(a));
    for (j = 0; j < m; ++j) ++a[st[i][j] - 'a'];
    for (j = 0; j < m; ++j)
      if (a[st[i][j] - 'a'] > 1) b[i][j] = 1;
  }
  for (j = 0; j < m; ++j) {
    memset(a, 0, sizeof(a));
    for (i = 0; i < n; ++i) ++a[st[i][j] - 'a'];
    for (i = 0; i < n; ++i)
      if (a[st[i][j] - 'a'] > 1) b[i][j] = 1;
  }
  for (i = 0; i < n; ++i)
    for (j = 0; j < m; ++j)
      if (b[i][j] == 0) printf("%c", st[i][j]);
  return 0;
}
