#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 5, M = 1e4 + 5, OO = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
int n, m;
char a[105][105];
int main() {
  cin >> 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 b = 1;
      for (int k = 0; k < n; ++k) {
        if (k != i) {
          if (a[i][j] == a[k][j]) b = 0;
        }
      }
      for (int k = 0; k < m; ++k) {
        if (k != j) {
          if (a[i][j] == a[i][k]) b = 0;
        }
      }
      if (b) cout << a[i][j];
    }
  }
  return 0;
}
