#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  int mas[105][105], row[105][30], col[105][30], i, j;
  memset(row, 0, sizeof(row));
  memset(col, 0, sizeof(col));
  int n, m;
  scanf("%d%d\n", &n, &m);
  for (i = 1; i <= n; i++) {
    getline(cin, str);
    for (j = 1; j <= m; j++) {
      mas[i][j] = str[j - 1] - 'a';
      row[i][str[j - 1] - 'a']++;
      col[j][str[j - 1] - 'a']++;
    }
  }
  str = "";
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (row[i][mas[i][j]] < 2 && col[j][mas[i][j]] < 2)
        str += mas[i][j] + 'a';
  printf("%s\n", str.c_str());
  return 0;
}
