#include <bits/stdc++.h>
char table[110][110];
int vis[110][110];
int exis[100];
char res[110000];
int main() {
  int n, m;
  int i, j;
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(vis, 0, sizeof(vis));
    for (i = 0; i < n; i++) scanf("%s", table[i]);
    for (i = 0; i < n; i++) {
      memset(exis, 0, sizeof(exis));
      for (j = 0; j < m; j++) exis[table[i][j] - 'a']++;
      for (j = 0; j < m; j++)
        if (exis[table[i][j] - 'a'] > 1) vis[i][j] = 1;
    }
    for (j = 0; j < m; j++) {
      memset(exis, 0, sizeof(exis));
      for (i = 0; i < n; i++) exis[table[i][j] - 'a']++;
      for (i = 0; i < n; i++)
        if (exis[table[i][j] - 'a'] > 1) vis[i][j] = 1;
    }
    int cnt = 0;
    for (i = 0; i < n; i++)
      for (j = 0; j < m; j++)
        if (!vis[i][j]) res[cnt++] = table[i][j];
    res[cnt] = '\0';
    printf("%s\n", res);
  }
}
