#include <bits/stdc++.h>
using namespace std;
const int maxn = 200;
int n, m;
int vis1[maxn][maxn];
int vis2[maxn][maxn];
char a[maxn][maxn];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
    }
  }
  memset(vis1, 0, sizeof(vis1));
  memset(vis2, 0, sizeof(vis2));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      for (int k = j + 1; k <= m; k++) {
        if (a[i][j] == a[i][k]) {
          vis1[i][j] = 1;
          vis1[i][k] = 1;
        }
      }
    }
  }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      for (int k = j + 1; k <= n; k++) {
        if (a[j][i] == a[k][i]) {
          vis2[j][i] = 1;
          vis2[k][i] = 1;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (vis1[i][j] == 0 && vis2[i][j] == 0) cout << a[i][j];
    }
  }
  return 0;
}
