#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n;
  string s;
  char x[100][100];
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> x[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int check = 0;
      for (int a = j - 1; a >= 0; a--) {
        if (x[i][j] == x[i][a]) {
          check++;
        }
      }
      for (int a = j + 1; a < m; a++) {
        if (x[i][j] == x[i][a]) {
          check++;
        }
      }
      for (int a = i + 1; a < n; a++) {
        if (x[i][j] == x[a][j]) {
          check++;
        }
      }
      for (int a = i - 1; a >= 0; a--) {
        if (x[i][j] == x[a][j]) {
          check++;
        }
      }
      if (check == 0) {
        s += x[i][j];
      }
    }
  }
  cout << s;
  return 0;
}
