#include <bits/stdc++.h>
using namespace std;
const int SIZ = 100000;
const int INF = (1 << 29);
const double EPS = 1e-11;
const double PI = acos(-1.0);
void SWAP(int &a, int &b) {
  int t = a;
  a = b;
  b = t;
}
int MAX(int a, int b) { return a > b ? a : b; }
int MIN(int a, int b) { return a < b ? a : b; }
int GCD(int a, int b) {
  while (b) {
    b ^= a ^= b ^= a %= b;
  }
  return a;
}
int main() {
  int i, j, n, m;
  char ch[110][110], th[110][110];
  int ar[29];
  while (scanf("%d %d", &n, &m) == 2) {
    for (i = 0; i < n; i++) scanf("%s", ch[i]);
    for (i = 0; i < n; i++)
      for (j = 0; j < m; j++) th[i][j] = ch[i][j];
    for (i = 0; i < n; i++) {
      memset(ar, -1, sizeof(ar));
      for (j = 0; j < m; j++) {
        if (ar[ch[i][j] - 97] == -1)
          ar[ch[i][j] - 97] = j;
        else {
          th[i][j] = '#';
          th[i][ar[ch[i][j] - 97]] = '#';
        }
      }
    }
    for (j = 0; j < m; j++) {
      memset(ar, -1, sizeof(ar));
      for (i = 0; i < n; i++) {
        if (ar[ch[i][j] - 97] == -1)
          ar[ch[i][j] - 97] = i;
        else {
          th[i][j] = '#';
          th[ar[ch[i][j] - 97]][j] = '#';
        }
      }
    }
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (th[i][j] != '#') printf("%c", ch[i][j]);
      }
    }
    puts("");
  }
  return 0;
}
