#include <bits/stdc++.h>
using namespace std;
const int MX = 1 * pow(2, 31);
const int MN = 1 * pow(2, -31);
int main() {
  int n, m;
  char st[121][121];
  char tem[121][121];
  while (scanf("%d%d", &n, &m) == 2) {
    getchar();
    for (int i = 0; i < n; ++i) {
      scanf("%s", st[i]);
      strcpy(tem[i], st[i]);
    }
    int x, y;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        if (st[i][j] == '?') continue;
        x = i;
        y = j;
        int flag = 0;
        for (int k = 0; k < m; ++k) {
          if (k == j) continue;
          if (st[i][j] == tem[i][k]) {
            flag = 1;
            break;
          }
        }
        if (flag == 1) st[x][y] = '?';
        flag = 0;
        for (int k = 0; k < n; ++k) {
          if (k == i) continue;
          if (tem[k][j] == st[i][j]) {
            flag = 1;
            break;
          }
        }
        if (flag == 1) st[x][y] = '?';
        flag = 0;
      }
    }
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        if (st[i][j] == '?') continue;
        printf("%c", st[i][j]);
      }
    }
    printf("\n");
  }
  return 0;
}
