#include <bits/stdc++.h>
using namespace std;
const int MX = 103;
char arr[MX][MX];
int n, m;
int in_row(int row, char c) {
  int ret = 0;
  for (int i = 0; i < m; i++)
    if (arr[row][i] == c) ret++;
  return ret;
}
int in_col(int col, char c) {
  int ret = 0;
  for (int i = 0; i < n; i++)
    if (arr[i][col] == c) ret++;
  return ret;
}
int main() {
  cin >> n >> m;
  string ans = "";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> arr[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char c = arr[i][j];
      if (in_row(i, c) <= 1 && in_col(j, c) <= 1) ans += c;
    }
  }
  cout << ans;
  return 0;
}
