#include <bits/stdc++.h>
using namespace std;
using tint = long long;
using ld = long double;
using vi = vector<tint>;
using pi = pair<int, int>;
const int MOD = 1e9 + 7;
const int MX = 2e5 + 5;
const int INF = 1e9;
const ld PI = acos(ld(-1));
void NACHO(string name = "out") {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
}
struct segtree {
  int size;
  vector<tint> st;
  void init(int n) {
    size = 1;
    while (size < n) {
      size *= 2;
    }
    st.assign(2 * size, 0);
  }
  void build(int node, int tl, int tr, vi &a) {
    if (tr - tl == 1) {
      if (tl < (int)(a).size()) st[node] = a[tl];
      return;
    }
    int tm = (tl + tr) / 2;
    build(2 * node + 1, tl, tm, a);
    build(2 * node + 2, tm, tr, a);
    st[node] = min(st[2 * node + 1], st[2 * node + 2]);
  }
  void build(vi &a) { build(0, 0, size, a); }
  void update(int pos, int val, int node, int tl, int tr) {
    if (tr - tl == 1) {
      st[node] = val;
      return;
    }
    int tm = (tl + tr) / 2;
    if (pos < tm) {
      update(pos, val, 2 * node + 1, tl, tm);
    } else {
      update(pos, val, 2 * node + 2, tm, tr);
    }
    st[node] = min(st[2 * node + 1], st[2 * node + 2]);
  }
  void update(int pos, int val) { update(pos, val, 0, 0, size); }
  tint sum(int node, int tl, int tr, int l, int r) {
    if (tl >= r || tr <= l) return INF;
    if (l <= tl && tr <= r) return st[node];
    int tm = (tl + tr) / 2;
    return min(sum(2 * node + 1, tl, tm, l, r),
               sum(2 * node + 2, tm, tr, l, r));
  }
  tint sum(int l, int r) { return sum(0, 0, size, l, r); }
};
int main() {
  NACHO();
  int n, m;
  cin >> n >> m;
  vector<vi> oc(n, vi(m, 1));
  vector<string> b(n);
  for (tint i = 0; i < tint(n); i++) {
    cin >> b[i];
  }
  for (tint i = 0; i < tint(n); i++) {
    vi seen(26, 0);
    for (tint j = 0; j < tint(m); j++) {
      seen[b[i][j] - 'a']++;
    }
    for (tint j = 0; j < tint(m); j++)
      if (seen[b[i][j] - 'a'] > 1) oc[i][j] = 0;
  }
  for (tint i = 0; i < tint(m); i++) {
    vi seen(26, 0);
    for (tint j = 0; j < tint(n); j++) {
      seen[b[j][i] - 'a']++;
    }
    for (tint j = 0; j < tint(n); j++)
      if (seen[b[j][i] - 'a'] > 1) oc[j][i] = 0;
  }
  for (tint i = 0; i < tint(n); i++)
    for (tint j = 0; j < tint(m); j++)
      if (oc[i][j] == 1) cout << b[i][j];
}
