#include <bits/stdc++.h>
using namespace std;
long long rdtsc() {
  long long tmp;
  asm("rdtsc" : "=A"(tmp));
  return tmp;
}
inline int myrand() { return abs((rand() << 15) ^ rand()); }
inline int rnd(int x) { return myrand() % x; }
const int maxn = (int)1e3 + 10;
int a[maxn][maxn];
void build(int n) {
  assert(n & 1);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i == j) continue;
      int diff = j - i;
      if (diff < 0) diff += n;
      if (diff & 1) a[i][j] = 1;
    }
  }
}
const int maxc = 30;
int used[maxc];
void check(int n) {
  if (n >= maxc) return;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) used[j] = 0;
    used[i] = 1;
    for (int j = 0; j < n; ++j) {
      assert(a[i][j] + a[j][i] == (i != j));
      if (!a[i][j]) continue;
      used[j] = 1;
      for (int k = 0; k < n; ++k) {
        if (!a[j][k]) continue;
        used[k] = 1;
      }
    }
    assert(count(used, used + n, 1) == n);
  }
}
bool solve() {
  int n;
  if (scanf("%d", &n) < 1) return 0;
  if (n == 4) {
    printf("-1\n");
    return 1;
  }
  memset(a, 0, sizeof(a));
  if (n & 1) {
    build(n);
  } else {
    build(n - 3);
    for (int i = 0; i < n - 3; ++i) {
      a[i][n - 1] = 1;
      if (i < n - 4)
        a[n - 2][i] = 1;
      else
        a[i][n - 2] = 1;
      if (i != 0)
        a[n - 3][i] = 1;
      else
        a[i][n - 3] = 1;
    }
    a[n - 1][n - 2] = a[n - 1][n - 3] = a[n - 2][n - 3] = 1;
  }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < n; ++j) printf("%d%c", a[i][j], " \n"[j == n - 1]);
  check(n);
  return 1;
}
int main() {
  srand(rdtsc());
  while (1) {
    if (!solve()) break;
  }
  return 0;
}
