#include <bits/stdc++.h>
using namespace std;
const int MAX = 100;
int main() {
  ios::sync_with_stdio(false);
  char a[MAX][MAX];
  bool r[MAX][MAX] = {0};
  int n, m;
  cin >> m >> n;
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++) cin >> a[i][j];
  for (int i = 0; i < m; i++) {
    int c[26] = {0};
    for (int j = 0; j < n; j++) c[a[i][j] - 'a']++;
    for (int j = 0; j < n; j++)
      if (c[a[i][j] - 'a'] > 1) r[i][j] = true;
  }
  for (int j = 0; j < n; j++) {
    int c[26] = {0};
    for (int i = 0; i < m; i++) c[a[i][j] - 'a']++;
    for (int i = 0; i < m; i++)
      if (c[a[i][j] - 'a'] > 1) r[i][j] = true;
  }
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++)
      if (!r[i][j]) cout << a[i][j];
  return 0;
}
