#include <bits/stdc++.h>
#pragma GCC optimize(3)
using namespace std;
int n, m;
bool b[101][101];
char a[101][101];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  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; j++) {
      for (int k = i + 1; k <= n; k++)
        if (a[k][j] == a[i][j]) b[k][j] = true, b[i][j] = true;
      for (int k = i - 1; k >= 1; k--)
        if (a[k][j] == a[i][j]) b[k][j] = true, b[i][j] = true;
      for (int k = j + 1; k <= m; k++)
        if (a[i][k] == a[i][j]) b[i][k] = true, b[i][j] = true;
      for (int k = j - 1; k >= 1; k--)
        if (a[i][k] == a[i][j]) b[i][k] = true, b[i][j] = true;
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (b[i][j] == false) cout << a[i][j];
  return 0;
}
