#include <bits/stdc++.h>
using namespace std;
vector<string> cross;
bool flag[101][101];
int n, m;
int main() {
  int i, j, k;
  string str;
  cin >> n >> m;
  memset(flag, false, sizeof(flag));
  for (i = 0; i < n; i++) {
    cin >> str;
    cross.push_back(str);
  }
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) {
      for (k = j + 1; k < m; k++)
        if (cross[i][k] == cross[i][j]) flag[i][k] = flag[i][j] = true;
      for (k = i + 1; k < n; k++)
        if (cross[k][j] == cross[i][j]) flag[k][j] = flag[i][j] = true;
    }
  str = "";
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      if (!flag[i][j]) str += cross[i][j];
  cout << str;
  return 0;
}
