#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  string s = "";
  char A[100][100];
  cin >> a >> b;
  int test = 0;
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < b; j++) {
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < a; i++) {
    for (int j = 0; j < b; j++) {
      test = 0;
      for (int k = 0; k < b; k++) {
        if (A[i][k] == A[i][j]) test++;
      }
      for (int k = 0; k < a; k++) {
        if (A[k][j] == A[i][j]) test++;
      }
      if (test == 2) s += A[i][j];
    }
  }
  cout << s;
  return 0;
}
