#include <bits/stdc++.h>
using namespace std;
const int MX = 100;
bool vis[MX][MX];
int main() {
  char a[MX][MX];
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  string ans = "";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      bool f = 0;
      for (int c = j + 1; c < m; c++) {
        if (a[i][j] == a[i][c]) {
          f = 1;
          vis[i][c] = 1;
        }
      }
      for (int r = i + 1; r < n; r++) {
        if (a[i][j] == a[r][j]) {
          f = 1;
          vis[r][j] = 1;
        }
      }
      if (!f && !vis[i][j]) ans += a[i][j];
    }
  }
  cout << ans;
  return 0;
}
