#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
} ans[10000];
int alb[30], sumh[105], sumw[105];
int grid[105][105];
bool cmp(point a, point b) {
  if (a.x < b.x)
    return true;
  else if (a.x == b.x && a.y < b.y)
    return true;
  return false;
}
int main() {
  int n, m, cnt = 0;
  char c;
  scanf("%d %d", &n, &m);
  getchar();
  memset(alb, 0, sizeof(alb));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      scanf("%c", &c);
      alb[c - 'a'] = 1;
      grid[i][j] = c - 'a';
    }
    getchar();
  }
  for (int k = 0; k < 26; k++) {
    if (alb[k] != 1) continue;
    memset(sumh, 0, sizeof(sumh));
    memset(sumw, 0, sizeof(sumw));
    for (int i = 0; i < n; i++)
      for (int j = 0; j < m; j++)
        if (grid[i][j] == k) {
          sumh[i]++;
        }
    for (int j = 0; j < m; j++)
      for (int i = 0; i < n; i++)
        if (grid[i][j] == k) {
          sumw[j]++;
        }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        if (sumh[i] == 1 && sumw[j] == 1 && grid[i][j] == k) {
          ans[cnt].x = i;
          ans[cnt++].y = j;
        }
      }
    }
  }
  sort(ans, ans + cnt, cmp);
  for (int i = 0; i < cnt; i++) printf("%c", grid[ans[i].x][ans[i].y] + 'a');
  printf("\n");
  return 0;
}
