#include <bits/stdc++.h>
using namespace std;
double const pi = 3.1415926536;
int main() {
  int n, m;
  cin >> n >> m;
  char a[n][m];
  int f[n][m];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
      f[i][j] = 0;
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      for (int k = 0; k < m; k++) {
        if (a[i][j] == a[i][k] && j != k) {
          f[i][j] = 1;
          f[i][k] = 1;
        }
      }
    }
  for (int j = 0; j < m; j++)
    for (int i = 0; i < n; i++) {
      for (int k = 0; k < n; k++) {
        if (a[i][j] == a[k][j] && i != k) {
          f[i][j] = 1;
          f[k][j] = 1;
        }
      }
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      if (f[i][j] == 0) cout << a[i][j];
    }
}
