#include <bits/stdc++.h>
using namespace std;
int n = 0, m = 0;
char** values;
bool** values1;
void PrintArray() {
  cout << "Values\n";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << values[i][j] << " ";
    }
    cout << endl;
  }
  cout << "Values1\n";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cout << values1[i][j] << " ";
    }
    cout << endl;
  }
}
void Check(int i, int j) {
  char valueToCheck = values[i][j];
  if (i == n - 1) goto second;
  for (int i1 = i + 1; i1 < n; i1++) {
    if (valueToCheck == values[i1][j]) {
      values1[i][j] = true;
      values1[i1][j] = true;
    }
  }
second:
  if (j == m - 1) return;
  for (int j1 = j + 1; j1 < m; j1++) {
    if (valueToCheck == values[i][j1]) {
      values1[i][j] = true;
      values1[i][j1] = true;
    }
  }
}
void ConstructString() {
  string result = "";
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (values1[i][j] != true) result += values[i][j];
    }
  }
  cout << result;
}
int main() {
  string str, temp;
  cin >> n >> m;
  values = new char*[n + 1];
  values1 = new bool*[n + 1];
  for (int i = 0; i < n; i++) {
    values[i] = new char[m + 1];
    values1[i] = new bool[m + 1];
    memset(values1[i], 0, m + 1);
    cin >> values[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (values[i][j] == '*') continue;
      Check(i, j);
    }
  }
  ConstructString();
  for (int i = 0; i < n; ++i) {
    delete[] values[i];
    delete[] values1[i];
  }
  delete[] values;
  return 0;
}
