#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, counter, counter2, counter3, matrix[100][100];
  cin >> n >> m;
  string Array[n];
  for (counter2 = 0; counter2 < 100; ++counter2) {
    for (int counter3 = 0; counter3 < 100; ++counter3) {
      matrix[counter2][counter3] = 0;
    }
  }
  for (int counter = 0; counter < n; ++counter) {
    cin >> Array[counter];
  }
  for (counter = 0; counter < n; ++counter) {
    for (counter2 = 0; counter2 < m; ++counter2) {
      for (int counter3 = 0; counter3 < m; ++counter3) {
        if (counter2 != counter3) {
          if (Array[counter][counter2] == Array[counter][counter3]) {
            matrix[counter][counter2] = 1;
            matrix[counter][counter3] = 1;
          }
        }
      }
    }
  }
  for (counter = 0; counter < m; ++counter) {
    for (counter2 = 0; counter2 < n; ++counter2) {
      for (int counter3 = 0; counter3 < n; ++counter3) {
        if (counter2 != counter3) {
          if (Array[counter2][counter] == Array[counter3][counter]) {
            matrix[counter2][counter] = 1;
            matrix[counter3][counter] = 1;
          }
        }
      }
    }
  }
  for (counter2 = 0; counter2 < 100; ++counter2) {
    for (int counter3 = 0; counter3 < 100; ++counter3) {
      if (matrix[counter2][counter3] == 1) {
        Array[counter2][counter3] = 0;
      }
    }
  }
  for (counter2 = 0; counter2 < n; ++counter2) {
    for (int counter3 = 0; counter3 < m; ++counter3) {
      if (Array[counter2][counter3] != 0) {
        cout << Array[counter2][counter3];
      }
    }
  }
}
