#include <bits/stdc++.h>
using namespace std;
char f[100][100];
int main() {
  int n, m;
  cin >> n >> m;
  memset(f, 0, sizeof(f));
  int i = 1, j = 1;
  char ch;
  while (i <= n) {
    scanf("%c", &ch);
    if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z')) {
      f[i][j] = ch;
      j++;
      if (j > m) {
        i++;
        j = 1;
      }
    }
  }
  int flag = 0;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      flag = 0;
      for (int k = 1; k <= n; k++) {
        if (f[i][j] != 0 && f[i][j] == f[k][j] && i != k) {
          flag = 1;
          break;
        }
      }
      if (flag == 1) continue;
      for (int k = 1; k <= m; k++) {
        if (f[i][j] != 0 && f[i][j] == f[i][k] && j != k) {
          flag = 1;
          break;
        }
      }
      if (flag == 0) cout << f[i][j];
    }
  }
  cout << endl;
  return 0;
}
