#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int a, b;
  cin >> a >> b;
  char arr[101][101];
  char ar[101][101];
  map<char, int> mop;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < b; j++) {
      cin >> arr[i][j];
      ar[i][j] = arr[i][j];
    }
  }
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < b; j++) {
      if (arr[i][j] != '*') {
        mop[arr[i][j]]++;
        if (mop[arr[i][j]] > 1) {
          for (int k = 0; k < b; k++)
            if (arr[i][k] == arr[i][j]) arr[i][k] = '*';
          arr[i][j] = '*';
        }
      }
    }
    mop.clear();
  }
  mop.clear();
  for (int i = 0; i < b; i++) {
    for (int j = 0; j < a; j++) {
      if (ar[j][i] != '*') {
        mop[ar[j][i]]++;
        if (mop[ar[j][i]] > 1) {
          for (int k = 0; k < a; k++)
            if (ar[k][i] == ar[j][i]) ar[k][i] = '*';
          ar[j][i] = '*';
        }
      }
    }
    mop.clear();
  }
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < b; j++) {
      if (arr[i][j] == ar[i][j] && isalpha(arr[i][j])) cout << arr[i][j];
    }
  }
  return 0;
}
