#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  map<string, int> Map;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < M; j++) {
      string S;
      cin >> S;
      Map[S]++;
    }
  }
  int Sum = Map["10"] + Map["01"];
  int X1, X2;
  if (Sum % 2) {
    X1 = Sum / 2 + 1;
    X2 = Sum / 2;
  } else {
    X1 = Sum / 2;
    X2 = Sum / 2;
  }
  Map["10"] = X1;
  Map["01"] = X2;
  int Cnt = 0;
  while (Map["11"]-- && Cnt <= M) {
    cout << "11 ";
    Cnt++;
    if (Cnt == M) {
      cout << "\n";
      Cnt = 0;
    }
  }
  while (Map["01"]-- && Cnt <= M) {
    cout << "01 ";
    Cnt++;
    if (Cnt == M) {
      cout << "\n";
      Cnt = 0;
    }
  }
  while (Map["00"]-- && Cnt <= M) {
    cout << "00 ";
    Cnt++;
    if (Cnt == M) {
      cout << "\n";
      Cnt = 0;
    }
  }
  while (Map["10"]-- && Cnt <= M) {
    cout << "10 ";
    Cnt++;
    if (Cnt == M) {
      cout << "\n";
      Cnt = 0;
    }
  }
  return 0;
}
