#include <bits/stdc++.h>
typedef struct {
  int r, c;
} unit;
void eliminate(char M[100][100], int r_c_index, char r_c, char character, int n,
               int m) {
  if (r_c == 'r') {
    for (int j = 0; j < m; j++)
      if (M[r_c_index][j] == character) M[r_c_index][j] = ' ';
  } else if (r_c == 'c') {
    for (int i = 0; i < n; i++)
      if (M[i][r_c_index] == character) M[i][r_c_index] = ' ';
  }
}
void print_special(unit Special[100][100], int max) {
  for (int i = 0; i < max; i++) {
    for (int j = 0; j < 26; j++)
      printf("(%d,%d) ", Special[i][j].r, Special[i][j].c);
    printf("\n");
  }
}
void print_m(char M[100][100], int n, int m) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++)
      if (M[i][j] == ' ')
        printf(".");
      else
        printf("%c", M[i][j]);
    printf("\n");
  }
}
int main() {
  char M[100][100] = {};
  unit Special[100][26] = {};
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf(" %[^\n]", M[i]);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      Special[i][M[i][j] - 'a'].r++;
      Special[j][M[i][j] - 'a'].c++;
    }
  }
  int max = 0;
  (m > n) ? (max = m) : (max = n);
  for (int i = 0; i < max; i++) {
    for (int j = 0; j < 26; j++) {
      if (Special[i][j].r >= 2) eliminate(M, i, 'r', j + 'a', n, m);
      if (Special[i][j].c >= 2) eliminate(M, i, 'c', j + 'a', n, m);
    }
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (M[i][j] != ' ') printf("%c", M[i][j]);
  return 0;
}
