#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  char ch, str[n][m], str2[n][m];
  int i, j, p;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) {
      cin >> str[i][j];
      str2[i][j] = '#';
    }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      ch = str[i][j];
      for (p = 0; p < n; p++)
        if (str[p][j] == ch && p != i) {
          str2[i][j] = 'A';
          break;
        }
      for (p = 0; p < m; p++)
        if (str[i][p] == ch && p != j) {
          str2[i][j] = 'A';
          break;
        }
    }
  }
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      if (str2[i][j] == '#') cout << str[i][j];
  return 0;
}
