#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  char arr[n][m];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int temp = 0;
      for (int k = 0; k < n; k++) {
        if (k != i) {
          if (arr[k][j] == arr[i][j]) {
            temp++;
          }
        }
      }
      for (int l = 0; l < m; l++) {
        if (l != j) {
          if (arr[i][l] == arr[i][j]) {
            temp++;
          }
        }
      }
      if (!temp) {
        cout << arr[i][j];
      }
    }
  }
  return 0;
}
