#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  int m, n;
  cin >> n >> m;
  char g[100][100];
  vector<vector<int> > u(n, vector<int>(m, 1));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> g[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < n; k++) {
        if (k == i) continue;
        if (g[k][j] == g[i][j]) {
          u[k][j] = 0;
          u[i][j] = 0;
        }
      }
      for (int J = 0; J < m; J++) {
        if (J == j) continue;
        if (g[i][J] == g[i][j]) {
          u[i][j] = 0;
          u[i][J] = 0;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (u[i][j]) cout << g[i][j];
    }
  }
}
