#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  string str[102];
  int s[102][102];
  for (int i = 0; i < 101; i++)
    for (int j = 0; j < 101; j++) s[i][j] = 1;
  for (int i = 0; i < a; i++) cin >> str[i];
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < b; j++) {
      if (s[i][j] == 0) continue;
      for (int k = j + 1; k < b; k++)
        if (str[i][j] == str[i][k]) {
          s[i][j] = 0;
          s[i][k] = 0;
        }
    }
  }
  for (int i = 0; i < b; i++) {
    for (int j = 0; j < a; j++) {
      if (s[j][i] == 2) continue;
      for (int k = j + 1; k < a; k++)
        if (str[j][i] == str[k][i]) {
          s[j][i] = 2;
          s[k][i] = 2;
        }
    }
  }
  for (int i = 0; i < a; i++)
    for (int j = 0; j < b; j++)
      if (s[i][j] == 1) cout << str[i][j];
}
