#include <bits/stdc++.h>
using namespace std;
long long p = 1000000007;
vector<long long> rui(19, 1);
vector<long long> kai(1000007, 1);
vector<long long> ink(1000007, 1);
vector<long long> par;
long long nap(long long n, vector<long long> napw, vector<long long> napv) {
  if (napw.size() == 0) {
    return 0;
  }
  if (napw.size() == 1) {
    return (n / napw[0]) * napv[0];
  }
  if (napw.size() == 2) {
    long long ans = 0;
    long long lim = n / napw[0];
    for (long long c0 = 0; c0 < lim + 1; c0++) {
      long long c1 = (n - c0 * napw[0]) / napw[1];
      ans = max(ans, c0 * napv[0] + c1 * napv[1]);
    }
    return ans;
  }
  long long ans = 0;
  long long ex;
  long long lim = n / napw[0];
  long long nlim;
  for (long long c0 = 0; c0 < lim + 1; c0++) {
    ex = n - c0 * napw[0];
    nlim = ex / napw[1];
    for (long long c1 = 0; c1 < nlim + 1; c1++) {
      long long c2 = (ex - c1 * napw[1]) / napw[2];
      ans = max(ans, c0 * napv[0] + c1 * napv[1] + c2 * napv[2]);
    }
  }
  return ans;
}
signed main() {
  long long n;
  cin >> n;
  if (n < 10) {
    vector<long long> a(100, 1);
    for (long long i = 1; i < 100; i++) {
      for (long long j = 0; j < i; j++) {
        if ((j - i) % 3 != 0) {
          a[i] += a[j];
        }
      }
    }
    long long co = 0;
    vector<vector<long long> > way(n, vector<long long>(n, 0));
    long long st = 0;
    vector<bool> is_use(n, false);
    for (long long ind = 0; ind < n; ind++) {
      is_use[st] = true;
      long long n_st = st;
      if (ind % 2 == 0) {
        for (long long kai = 0; kai < n; kai++) {
          long long to = (st + n - kai) % n;
          if (!is_use[to]) {
            n_st = to;
            way[st][to] = a[co];
            way[to][st] = a[co];
            co++;
          }
        }
      } else {
        for (long long kai = 0; kai < n; kai++) {
          long long to = (st + kai) % n;
          if (!is_use[to]) {
            n_st = to;
            way[st][to] = a[co];
            way[to][st] = a[co];
            co++;
          }
        }
      }
      st = n_st;
    }
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < n; j++) {
        cout << way[i][j];
        if (j < n - 1) {
          cout << " ";
        } else {
          cout << endl;
        }
      }
    }
  } else {
    vector<long long> a(46, 1);
    long long now_sum = 0;
    long long co = 0;
    for (long long i = 0; i < n - 1; i++) {
      if (co != 0) {
        a[co] += now_sum + a[co - 2] + a[co - 3] - 1;
      }
      co++;
      if (i < n - 2) {
        if (i != 0) {
          a[co] += now_sum + a[co - 1] + a[co - 2] + a[co - 4];
          now_sum += a[co - 2] + a[co - 3];
        } else {
          a[co] = 2;
        }
        co++;
        for (long long j = 2; j < n - i - 1; j++) {
          a[co] += a[co - 1] + a[co - 2] + now_sum;
          co++;
        }
      }
    }
    co = 0;
    vector<vector<long long> > way(n, vector<long long>(n, 0));
    long long st = 0;
    vector<bool> is_use(n, false);
    for (long long ind = 0; ind < n; ind++) {
      is_use[st] = true;
      long long n_st = st;
      if (ind % 2 == 0) {
        for (long long kai = 0; kai < n; kai++) {
          long long to = (st + n - kai) % n;
          if (!is_use[to]) {
            n_st = to;
            way[st][to] = a[co];
            way[to][st] = a[co];
            co++;
          }
        }
      } else {
        for (long long kai = 0; kai < n; kai++) {
          long long to = (st + kai) % n;
          if (!is_use[to]) {
            n_st = to;
            way[st][to] = a[co];
            way[to][st] = a[co];
            co++;
          }
        }
      }
      st = n_st;
    }
    for (long long i = 0; i < n; i++) {
      for (long long j = 0; j < n; j++) {
        cout << way[i][j];
        if (j < n - 1) {
          cout << " ";
        } else {
          cout << endl;
        }
      }
    }
  }
  return 0;
}
