#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
const long long NN = 1e9 + 5;
char a[150][150];
map<char, bool> mp, mp1;
bool used[150][150];
long long n, m;
vector<char> v;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      for (int l = 1; l <= m; l++) {
        if (l != j && a[i][j] == a[i][l]) {
          used[i][l] = true;
        }
      }
      for (int l = 1; l <= n; l++) {
        if (l != i && a[l][j] == a[i][j]) {
          used[i][j] = true;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (!used[i][j]) {
        v.push_back(a[i][j]);
      }
    }
  }
  for (int i = 0; i < (int)v.size(); i++) {
    cout << v[i];
  }
}
