#include <bits/stdc++.h>
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,abm,mmx,avx,avx2,popcnt,tune=native")
#pragma GCC optimize("SEX_ON_THE_BEACH")
#pragma comment(linker, "/STACK:36777216")
using namespace std;
const int MAXN = 6e3 + 28;
const int inf = 1e9;
const long double PI = acos(-1);
const int mod = (int)998244353;
const int MOD = 1000000007;
const int MOD9 = 1000000009;
const int a228 = 18;
const long double obr = (long double)1 / sqrt(2);
int fl[7][7];
inline bool check(vector<pair<int, int>> &a) {
  for (int i = 1; i <= 6; ++i)
    for (int j = 1; j <= 6; ++j) fl[i][j] = inf;
  for (int i = 1; i < 7; ++i) fl[i][i] = 0;
  for (auto i : a) fl[i.first][i.second] = 1;
  for (int k = 1; k <= 6; ++k) {
    for (int i = 1; i <= 6; ++i) {
      for (int j = 1; j <= 6; ++j) {
        fl[i][j] = min(fl[i][j], fl[i][k] + fl[k][j]);
      }
    }
  }
  int n = 6;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (fl[i][j] > 2) {
        return 0;
      }
    }
  }
  return 1;
}
vector<pair<int, int>> ans;
void gen() {
  int n = 6;
  vector<pair<int, int>> a;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) a.push_back({i, j});
  }
  for (int msk = 0; msk < (1 << 15); ++msk) {
    auto x = a;
    for (int j = 0; j < 15; ++j) {
      if ((msk >> j) & 1) swap(x[j].first, x[j].second);
    }
    if (check(x)) {
      ans = x;
      return;
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  srand(time(NULL));
  int n;
  cin >> n;
  if (n == 4) {
    cout << -1;
    return 0;
  }
  vector<vector<int>> g(n + 1, vector<int>(n + 1));
  if (n % 2) {
    g[1][2] = g[2][3] = g[3][1] = 1;
    for (int v = 4; v < n; v += 2) {
      g[v][v + 1] = 1;
      for (int i = 1; i < v; ++i) g[i][v] = 1, g[v + 1][i] = 1;
    }
  } else {
    vector<int> unusen = {};
    gen();
    for (auto i : ans) g[i.first][i.second] = 1;
    for (int v = 7; v < n; v += 2) {
      g[v][v + 1] = 1;
      for (int i = 1; i < v; ++i) g[i][v] = 1, g[v + 1][i] = 1;
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cout << g[i][j] << ' ';
    }
    cout << endl;
  }
}
