#include <bits/stdc++.h>
using namespace std;
int pos1, pos2;
int maxel(vector<int> v) {
  int l = -11111111;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] > l) {
      l = v[i];
      pos1 = i + 1;
    }
  }
  return l;
}
int minel(vector<int> v) {
  int l = 11111111;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] < l) {
      l = v[i];
      pos2 = i + 1;
    }
  }
  return l;
}
bool cheaki(char arr1[101][101], int i, int j, char m, int i1, int j1) {
  for (int k = 0; k < j; k++) {
    char p = arr1[i][k];
    if (i == i1 && k == j1) {
      continue;
    }
    if (arr1[i][k] == m) {
      return false;
    }
  }
  return true;
}
bool cheakj(char arr1[101][101], int i, int j, char m, int i1, int j1) {
  for (int k = 0; k < i; k++) {
    char h = arr1[k][j];
    if (k == i1 && j == j1) {
      continue;
    }
    if (arr1[k][j] == m) {
      return false;
    }
  }
  return true;
}
int main() {
  char arr[101][101];
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
    }
  }
  vector<char> v;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char t = arr[i][j];
      if (cheaki(arr, i, m, t, i, j) && cheakj(arr, n, j, t, i, j)) {
        v.push_back(t);
      }
    }
  }
  for (int i = 0; i < v.size(); i++) {
    cout << v[i];
  }
  cout << endl;
  return 0;
}
