#include <bits/stdc++.h>
using namespace std;
char ma[110][110];
bool v[110][110];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    getchar();
    for (int j = 1; j <= m; ++j) scanf("%c", &ma[i][j]);
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      for (int k = 1; k <= n; ++k)
        if (!v[k][j] && ma[k][j] == ma[i][j] && k != i) v[k][j] = 1;
      for (int k = 1; k <= m; ++k)
        if (!v[i][k] && ma[i][k] == ma[i][j] && k != j) v[i][k] = 1;
    }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      if (!v[i][j]) printf("%c", ma[i][j]);
  puts("");
  return 0;
}
