#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = 1e9 + 7;
const int INF = 0x3f3f3f3f;
string s[110], ans[110];
int main() {
  int n, m, x;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
    ans[i] = s[i];
  }
  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 (s[i][j] == s[k][j]) {
          ans[i][j] = '#';
          break;
        }
      }
      for (int k = 0; k < m; k++) {
        if (k == j) continue;
        if (s[i][j] == s[i][k]) {
          ans[i][j] = '#';
          break;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++)
      if (ans[i][j] != '#') cout << ans[i][j];
  }
  return 0;
}
