#include <bits/stdc++.h>
using namespace std;
const int M = 1 << 9;
char str[M][M];
bool has_all(char *col, vector<int> &inds) {
  for (int i = 0; i < (int)inds.size(); ++i)
    if (col[inds[i]] == '0') return false;
  return true;
}
bool go(vector<char *> &v, int n, int m) {
  int cnt[M * 4], cnt_a[M * 4], cnt_b[M * 4];
  int max_ind = -1;
  for (int i = 0; i < n; ++i) {
    cnt[i] = 0;
    for (int j = 0; j < m; ++j)
      if (v[j][i] == '1') ++cnt[i];
    if (cnt[i] != m) {
      if (max_ind == -1 || cnt[max_ind] < cnt[i]) max_ind = i;
    }
  }
  if (max_ind == -1 || cnt[max_ind] <= 1) return true;
  vector<char *> a, b;
  for (int i = 0; i < m; ++i)
    if (v[i][max_ind] == '1')
      a.push_back(v[i]);
    else
      b.push_back(v[i]);
  int a_sz = cnt[max_ind];
  int b_sz = (int)b.size();
  vector<int> common;
  for (int i = 0; i < n; ++i) {
    cnt_a[i] = 0;
    for (int j = 0; j < a_sz; ++j)
      if (a[j][i] == '1') ++cnt_a[i];
    cnt_b[i] = 0;
    for (int j = 0; j < b_sz; ++j)
      if (b[j][i] == '1') ++cnt_b[i];
    if (cnt_a[i] > 0 && cnt_b[i] > 0 && cnt_a[i] + cnt_b[i] != m)
      common.push_back(i);
  }
  set<int> first_bound, second_bound;
  if ((int)common.size() > 0) {
    first_bound.insert(0);
    for (int j = 0; j < b_sz; ++j)
      if (b[j][common[0]] == '1')
        for (int k = 1; k < (int)common.size(); ++k)
          if (b[j][common[k]] == '1') first_bound.insert(k);
  }
  vector<int> bound1, bound2;
  for (int k = 0; k < (int)common.size(); ++k)
    if (first_bound.count(k) == 0)
      bound2.push_back(common[k]);
    else
      bound1.push_back(common[k]);
  if ((int)bound1.size() > 0) {
    bool candidate_exists = false;
    for (int j = 0; j < a_sz; ++j) {
      bool has_all = true;
      for (int k = 0; k < (int)bound1.size(); ++k)
        if (a[j][bound1[k]] == '0') {
          has_all = false;
          break;
        }
      if (has_all) {
        a[j][n] = '0';
        candidate_exists = true;
      } else
        a[j][n] = '1';
    }
    if (!candidate_exists) {
      return false;
    }
    ++n;
  }
  if ((int)bound2.size() > 0) {
    bool candidate_exists = false;
    for (int j = 0; j < a_sz; ++j) {
      bool has_all = true;
      for (int k = 0; k < (int)bound2.size(); ++k)
        if (a[j][bound2[k]] == '0') {
          has_all = false;
          break;
        }
      if (has_all) {
        a[j][n] = '0';
        candidate_exists = true;
      } else
        a[j][n] = '1';
    }
    if (!candidate_exists) {
      return false;
    }
    ++n;
  }
  if (!go(a, n, a_sz)) {
    return false;
  }
  if ((int)bound1.size() > 0) {
    --n;
  }
  if ((int)bound2.size() > 0) {
    --n;
  }
  if ((int)bound1.size() > 0) {
    bool candidate_exists1, candidate_exists2 = false;
    for (int j = 0; j < b_sz; ++j) {
      bool has_all1 = true, has_any1 = false;
      for (int k = 0; k < (int)bound1.size(); ++k)
        if (b[j][bound1[k]] == '0') {
          has_all1 = false;
        } else {
          has_any1 = true;
        }
      bool has_all2 = (int)bound2.size() > 0, has_any2 = false;
      for (int k = 0; k < (int)bound2.size(); ++k)
        if (b[j][bound2[k]] == '0') {
          has_all2 = false;
        } else {
          has_any2 = true;
        }
      if (has_any1 && has_any2) {
        return false;
      }
      if (has_all1) {
        b[j][n] = '1';
        candidate_exists1 = true;
      } else if (has_all2) {
        b[j][n] = '1';
        candidate_exists2 = true;
      } else
        b[j][n] = '0';
    }
    if (!candidate_exists1 || ((int)bound2.size() > 0 && !candidate_exists2)) {
      return false;
    }
    if ((int)bound2.size() == 0) {
      char *col = new char[M * 4];
      for (int i = 0; i < n; ++i) col[i] = '0';
      col[n] = '1';
      b.push_back(col);
      ++b_sz;
    }
    ++n;
  }
  if (!go(b, n, b_sz)) {
    return false;
  }
  v.clear();
  if ((int)bound1.size() == 0) {
    for (int j = 0; j < a_sz; ++j) v.push_back(a[j]);
    for (int j = 0; j < b_sz; ++j) v.push_back(b[j]);
    return true;
  }
  if ((int)bound2.size() == 0) {
    bool fake_found = false;
    for (int j = 0; j < b_sz; ++j) {
      bool is_fake = b[j][n - 1] == '1';
      if (is_fake) {
        for (int i = 0; i < n - 1; ++i)
          if (b[j][i] == '1') {
            is_fake = false;
            break;
          }
      }
      if (is_fake) {
        if (fake_found) throw -1;
        fake_found = true;
        bool has_all_b = j > 0 && has_all(b[j - 1], bound1);
        bool has_all_a = has_all(a[0], bound1);
        if (has_all_a != has_all_b) {
          for (int k = a_sz - 1; k >= 0; --k) v.push_back(a[k]);
        } else {
          for (int k = 0; k < a_sz; ++k) v.push_back(a[k]);
        }
        bool has_all_b2 = j < b_sz - 1 && has_all(b[j + 1], bound1);
        bool has_all_a2 = has_all(a[a_sz - 1], bound1);
        if (has_all_b == has_all_b2)
          while (true)
            ;
        if (has_all_a == has_all_a2)
          while (true)
            ;
      } else
        v.push_back(b[j]);
    }
    if (!fake_found)
      while (true)
        ;
    return true;
  }
  bool has_all1 = false, has_all2 = false;
  bool found = false;
  for (int j = 0; j < b_sz; ++j) {
    bool has_all1_cur = has_all(b[j], bound1);
    bool has_all2_cur = has_all(b[j], bound2);
    if ((has_all1 && has_all2_cur) || (has_all2 && has_all1_cur)) {
      if (found) throw -1;
      found = true;
      bool has_all_a1 = has_all(a[0], bound1);
      if (has_all1 != has_all_a1) {
        for (int j = a_sz - 1; j >= 0; --j) v.push_back(a[j]);
      } else {
        for (int j = 0; j < a_sz; ++j) v.push_back(a[j]);
      }
    }
    has_all1 = has_all1_cur;
    has_all2 = has_all2_cur;
    v.push_back(b[j]);
  }
  if (!found) throw -1;
  return true;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%s", str[i]);
  vector<char *> v;
  for (int j = 0; j < n; ++j) {
    char *col = new char[M * 4];
    for (int i = 0; i < n; ++i) col[i] = str[i][j];
    v.push_back(col);
  }
  if (!go(v, n, n)) {
    puts("NO");
    return 0;
  }
  puts("YES");
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) putchar(v[j][i]);
    puts("");
  }
  return 0;
}
