#include <bits/stdc++.h>
using namespace std;
char buffer[120][110];
bool release[120][110];
int main() {
  memset(release, 0, sizeof(release));
  int x, y;
  scanf("%d%d", &x, &y);
  gets(buffer[0]);
  for (int i = 0; i < x; i++) {
    gets(buffer[i]);
  }
  for (int i = 0; i < x; i++) {
    for (int j = 0; j < y; j++) {
      for (int k = 0; k < y; k++)
        if (k != j) {
          if (buffer[i][j] == buffer[i][k]) {
            release[i][k] = true;
            release[i][j] = true;
          }
        }
      for (int k = 0; k < x; k++)
        if (k != i) {
          if (buffer[i][j] == buffer[k][j]) {
            release[k][j] = true;
            release[i][j] = true;
          }
        }
    }
  }
  for (int i = 0; i < x; i++) {
    for (int j = 0; j < y; j++)
      if (!release[i][j]) printf("%c", buffer[i][j]);
  }
  printf("\n");
  return 0;
}
