#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
int main() {
  int n, m;
  cin >> n >> m;
  char a[102][102];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> a[i][j];
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m - 1; j++)
      for (int k = j + 1; k <= m; k++)
        if (tolower(a[i][j]) == tolower(a[i][k])) {
          a[i][k] = toupper(a[i][k]);
          a[i][j] = toupper(a[i][j]);
        }
  int index = 1;
  while (index != m + 1) {
    for (int i = 1; i <= n - 1; i++)
      for (int j = i + 1; j <= n; j++)
        if (tolower(a[i][index]) == tolower(a[j][index])) {
          a[i][index] = toupper(a[i][index]);
          a[j][index] = toupper(a[j][index]);
        }
    index++;
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (a[i][j] == tolower(a[i][j])) cout << a[i][j];
  return 0;
}
