#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
}
bool sortby(const pair<int, int>& a, const pair<int, int>& b) {
  if (a.first >= b.first && a.second >= b.second) return true;
  return false;
}
double area(int x1, int y1, int x2, int y2, int x3, int y3) {
  return abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
bool arr[6][6];
int arr2[6];
int main() {
  fast();
  int n, m;
  cin >> n >> m;
  vector<string> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  string s = "";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      bool b = true;
      for (int h = 0; h < m; h++) {
        if (h != j && v[i][h] == v[i][j]) b = false;
      }
      for (int h = 0; h < n; h++) {
        if (h != i && v[h][j] == v[i][j]) b = false;
      }
      if (b) s += v[i][j];
    }
  }
  cout << s << endl;
  return 0;
}
