#include <bits/stdc++.h>
using namespace std;
int main() {
  int str[105][105];
  char a[105][105];
  int s[26];
  int n, m;
  int i, j;
  while (scanf("%d%d", &n, &m) != EOF) {
    for (i = 1; i <= n; i++) {
      scanf("%s", a[i] + 1);
    }
    for (i = 1; i <= 100; i++) memset(str[i], 0, sizeof(str[i]));
    for (i = 1; i <= n; i++) {
      memset(s, 0, sizeof(s));
      for (j = 1; j <= m; j++) {
        if (s[a[i][j] - 'a'] == 0)
          s[a[i][j] - 'a'] = j;
        else {
          str[i][s[a[i][j] - 'a']] = 1;
          str[i][j] = 1;
        }
      }
    }
    for (j = 1; j <= m; j++) {
      memset(s, 0, sizeof(s));
      for (i = 1; i <= n; i++) {
        if (s[a[i][j] - 'a'] == 0)
          s[a[i][j] - 'a'] = i;
        else {
          str[s[a[i][j] - 'a']][j] = 1;
          str[i][j] = 1;
        }
      }
    }
    for (i = 1; i <= n; i++)
      for (j = 1; j <= m; j++) {
        if (str[i][j] != 1) printf("%c", a[i][j]);
      }
    printf("\n");
  }
}
