#include <bits/stdc++.h>
using namespace std;
char a[101][101];
bool used[101][101];
int n, m;
string ans;
int main() {
  memset(used, 0, sizeof used);
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    for (int j = 0; j < m; j++) a[i][j] = s[j];
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      for (int x = 0; x < n; x++)
        if (x != i && a[x][j] == a[i][j]) used[x][j] = 1;
      for (int y = 0; y < m; y++)
        if (y != j && a[i][y] == a[i][j]) used[i][y] = 1;
    }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++)
      if (!used[i][j]) ans += a[i][j];
  }
  cout << ans << endl;
  return 0;
}
