#include <bits/stdc++.h>
using namespace std;
char mat[110][110];
bool mark[110][110];
char str[110000];
int main() {
  int i, j, k, N, M;
  while (scanf("%d%d", &N, &M) != EOF) {
    for (i = 0; i < N; i++) scanf("%s", &mat[i]);
    memset(mark, false, sizeof(mark));
    for (i = 0; i < N; i++) {
      for (j = 0; j < M; j++)
        for (k = j + 1; k < M; k++)
          if (mat[i][j] == mat[i][k]) mark[i][j] = mark[i][k] = true;
    }
    for (j = 0; j < M; j++)
      for (i = 0; i < N; i++)
        for (k = i + 1; k < N; k++)
          if (mat[i][j] == mat[k][j]) mark[i][j] = mark[k][j] = true;
    k = 0;
    for (i = 0; i < N; i++)
      for (j = 0; j < M; j++)
        if (!mark[i][j]) str[k++] = mat[i][j];
    str[k] = 0;
    printf("%s\n", str);
  }
}
