#include <bits/stdc++.h>
using namespace std;
const long long M = 1000000007;
bool comp(pair<int, int> a, pair<int, int> b) { return a.second < b.second; }
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1;
  while (t--) {
    string str = "";
    int n, m;
    cin >> n >> m;
    char a[n][m];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cin >> a[i][j];
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        bool check = true;
        for (int k = 0; k < n; k++) {
          if (a[i][j] == a[k][j] && i != k) check = false;
        }
        for (int l = 0; l < m; l++) {
          if (a[i][j] == a[i][l] && j != l) check = false;
        }
        if (check) {
          cout << a[i][j];
        }
      }
    }
  }
  return 0;
}
