#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, del[100][100];
  char c[100][101];
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> c[i][j];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      for (int k = 0; k < m; k++)
        if (j != k && c[i][j] == c[i][k]) del[i][j] = 1;
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++)
      for (int k = 0; k < n; k++)
        if (j != k && c[j][i] == c[k][i]) del[j][i] = 1;
  string ans;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (!del[i][j]) ans += c[i][j];
  cout << ans << endl;
}
