#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
namespace Bigcat {
template <typename T>
inline void max_s(T& a, const T& b) {
  a = max(a, b);
}
template <typename T>
inline void min_s(T& a, const T& b) {
  a = min(a, b);
}
template <typename T>
void sort_v(T& x) {
  sort(x.begin(), x.end());
}
template <typename T>
void erase_dup(T& x) {
  x.erase(unique(x.begin(), x.end()), x.end());
}
template <typename T, typename V>
int pos_l(const T& x, const V& v) {
  return lower_bound(x.begin(), x.end(), v) - x.begin();
}
template <typename T, typename V>
int pos_u(const T& x, const V& v) {
  return upper_bound(x.begin(), x.end(), v) - x.begin();
}
inline unsigned rand_g() {
  static mt19937 mt_rand((int)time(0));
  return mt_rand();
}
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using PII = pair<int, int>;
using VPII = vector<PII>;
}  // namespace Bigcat
using namespace Bigcat;
const LL base = LL(1e9 + 7);
const LL INFL = 1LL << 62;
const int INF = 1 << 30;
const int MAX = int(2e5 + 100);
struct Node {
  int x, y, w;
};
bool operator<(const Node& n0, const Node& n1) { return n0.x < n1.y; }
LL zr[30][200] = {
    {
        0LL,
        185236053LL,
        185236053LL,
        0LL,
    },
    {
        0LL,
        2104389822LL,
        2852874697LL,
        2104389822LL,
        0LL,
        1416425104LL,
        2852874697LL,
        1416425104LL,
        0LL,
    },
    {
        0LL,
        1906115952LL,
        1467735921LL,
        1181084982LL,
        1906115952LL,
        0LL,
        167334318LL,
        153085920LL,
        1467735921LL,
        167334318LL,
        0LL,
        1580925067LL,
        1181084982LL,
        153085920LL,
        1580925067LL,
        0LL,
    },
    {
        0LL,          2572340963LL, 873934786LL,  3412397800LL, 2780922943LL,
        2572340963LL, 0LL,          1909111963LL, 3072104815LL, 2368752863LL,
        873934786LL,  1909111963LL, 0LL,          1361405334LL, 3017143853LL,
        3412397800LL, 3072104815LL, 1361405334LL, 0LL,          2507765706LL,
        2780922943LL, 2368752863LL, 3017143853LL, 2507765706LL, 0LL,
    },
    {
        0LL,          1342730838LL, 1235316997LL, 969750379LL,  920246400LL,
        2500045187LL, 1342730838LL, 0LL,          2026850108LL, 2967708959LL,
        2885359272LL, 1977828470LL, 1235316997LL, 2026850108LL, 0LL,
        3473969762LL, 2965552720LL, 924551753LL,  969750379LL,  2967708959LL,
        3473969762LL, 0LL,          872485401LL,  505251567LL,  920246400LL,
        2885359272LL, 2965552720LL, 872485401LL,  0LL,          231191228LL,
        2500045187LL, 1977828470LL, 924551753LL,  505251567LL,  231191228LL,
        0LL,
    },
    {
        0LL,          3354765621LL, 341117896LL,  227982333LL,  2168553967LL,
        2769427951LL, 1038902527LL, 3354765621LL, 0LL,          404751632LL,
        1357340976LL, 2712413566LL, 3248797623LL, 3904621960LL, 341117896LL,
        404751632LL,  0LL,          1662847208LL, 3490911737LL, 3962712969LL,
        314068848LL,  227982333LL,  1357340976LL, 1662847208LL, 0LL,
        1673956580LL, 2038632242LL, 1589848208LL, 2168553967LL, 2712413566LL,
        3490911737LL, 1673956580LL, 0LL,          2337390679LL, 952586505LL,
        2769427951LL, 3248797623LL, 3962712969LL, 2038632242LL, 2337390679LL,
        0LL,          3300877139LL, 1038902527LL, 3904621960LL, 314068848LL,
        1589848208LL, 952586505LL,  3300877139LL, 0LL,
    },
    {
        0LL,          550587419LL,  872990904LL,  1846420250LL, 2697255586LL,
        1372748138LL, 2336758223LL, 1675801063LL, 550587419LL,  0LL,
        3854292135LL, 418461438LL,  531908676LL,  2439455187LL, 2555805313LL,
        495522208LL,  872990904LL,  3854292135LL, 0LL,          4144225858LL,
        3532033563LL, 1923566530LL, 3134690839LL, 834612296LL,  1846420250LL,
        418461438LL,  4144225858LL, 0LL,          1414454126LL, 3076881719LL,
        4127728532LL, 2155713602LL, 2697255586LL, 531908676LL,  3532033563LL,
        1414454126LL, 0LL,          575145860LL,  1973739143LL, 3290654351LL,
        1372748138LL, 2439455187LL, 1923566530LL, 3076881719LL, 575145860LL,
        0LL,          698244091LL,  3155577652LL, 2336758223LL, 2555805313LL,
        3134690839LL, 4127728532LL, 1973739143LL, 698244091LL,  0LL,
        2120404337LL, 1675801063LL, 495522208LL,  834612296LL,  2155713602LL,
        3290654351LL, 3155577652LL, 2120404337LL, 0LL,
    },
    {
        0LL,          3705930987LL, 2943574166LL, 3319909595LL, 2490041841LL,
        2651696812LL, 430465906LL,  3813403787LL, 1003729440LL, 3705930987LL,
        0LL,          2053680668LL, 24036325LL,   1097871036LL, 904367141LL,
        1197121009LL, 321705024LL,  519992081LL,  2943574166LL, 2053680668LL,
        0LL,          3145742200LL, 1251728081LL, 4222320987LL, 1056392575LL,
        2475323119LL, 2916965662LL, 3319909595LL, 24036325LL,   3145742200LL,
        0LL,          3155745615LL, 3151456033LL, 3011391101LL, 2916383299LL,
        91816478LL,   2490041841LL, 1097871036LL, 1251728081LL, 3155745615LL,
        0LL,          967148298LL,  3143808281LL, 927926284LL,  111386287LL,
        2651696812LL, 904367141LL,  4222320987LL, 3151456033LL, 967148298LL,
        0LL,          786955029LL,  1956574206LL, 756676300LL,  430465906LL,
        1197121009LL, 1056392575LL, 3011391101LL, 3143808281LL, 786955029LL,
        0LL,          2026750162LL, 745192660LL,  3813403787LL, 321705024LL,
        2475323119LL, 2916383299LL, 927926284LL,  1956574206LL, 2026750162LL,
        0LL,          925260316LL,  1003729440LL, 519992081LL,  2916965662LL,
        91816478LL,   111386287LL,  756676300LL,  745192660LL,  925260316LL,
        0LL,
    },
    {
        0LL,          264784192LL,  757678343LL,  238454099LL,  2423783243LL,
        859638814LL,  3940046230LL, 2642871318LL, 501815LL,     954981147LL,
        264784192LL,  0LL,          1666434691LL, 2175921495LL, 3655354459LL,
        3267829179LL, 2650539108LL, 2041851187LL, 4119350277LL, 4254841390LL,
        757678343LL,  1666434691LL, 0LL,          1375280754LL, 1276745323LL,
        24063811LL,   2880518537LL, 256896890LL,  1525334703LL, 596961268LL,
        238454099LL,  2175921495LL, 1375280754LL, 0LL,          3942008587LL,
        3701007857LL, 847062518LL,  3033142871LL, 112104017LL,  251298020LL,
        2423783243LL, 3655354459LL, 1276745323LL, 3942008587LL, 0LL,
        3106591049LL, 842099419LL,  2384909254LL, 2787361952LL, 3046879749LL,
        859638814LL,  3267829179LL, 24063811LL,   3701007857LL, 3106591049LL,
        0LL,          1118292239LL, 1066338114LL, 919839218LL,  4078448680LL,
        3940046230LL, 2650539108LL, 2880518537LL, 847062518LL,  842099419LL,
        1118292239LL, 0LL,          600838864LL,  1400529581LL, 130278587LL,
        2642871318LL, 2041851187LL, 256896890LL,  3033142871LL, 2384909254LL,
        1066338114LL, 600838864LL,  0LL,          1408488239LL, 3418218766LL,
        501815LL,     4119350277LL, 1525334703LL, 112104017LL,  2787361952LL,
        919839218LL,  1400529581LL, 1408488239LL, 0LL,          1732677666LL,
        954981147LL,  4254841390LL, 596961268LL,  251298020LL,  3046879749LL,
        4078448680LL, 130278587LL,  3418218766LL, 1732677666LL, 0LL,
    },
};
LL zm[20][20];
void solve1() {
  LL result = 0;
  int n;
  cin >> n;
  for (int g = 2; g <= 10; ++g) {
    g = n;
    while (true) {
      for (int i = 0; i < (int)(g); i++) {
        for (int j = 0; j < (int)(g); j++) {
          if (j <= i)
            zm[i][j] = zm[j][i];
          else
            zm[i][j] = rand_g() % 10000000000LL;
        }
      }
      VI zt(g);
      for (int i = 0; i < (int)(g); i++) {
        zt[i] = i;
      }
      unordered_set<LL> zs(10000000);
      bool ok = true;
      while (zt[0] < g - 1) {
        if (zt[0] < zt.back()) {
          LL d = 0;
          for (int i = 0; i < (int)(g - 1); i++) {
            d += zm[zt[i]][zt[i + 1]];
          }
          if (zs.count(d) > 0) {
            ok = false;
            break;
          }
        }
        next_permutation(zt.begin(), zt.end());
      }
      if (ok) {
        for (int i = 0; i < (int)(g); i++) {
          for (int j = 0; j < (int)(g); j++) {
            cout << zm[i][j] << " ";
          }
          cout << endl;
        }
        return;
      }
    }
  }
}
const bool _multi_test = false;
const int _inId = 0;
const int _outId = 0;
void io_init(char* s0) {
  string path(s0);
  int a = path.find("build\\");
  int b = path.find("Release\\");
  if (a > 0 && b > a) {
    path = path.substr(0, a) + path.substr(a + 6, b - a - 6);
  } else
    path = "";
  if (_inId > 0) {
    cerr << "redirect stdin to input " << _inId << endl;
    string s = "input";
    s += to_string(_inId);
    s += ".txt";
    if (path != "") s = path + s;
    auto r = freopen(s.c_str(), "r", stdin);
    if (r == nullptr) {
      cerr << "invalid input file " << s << endl;
      ;
      r = freopen("CON", "r", stdin);
    }
  }
  if (_outId > 0) {
    cerr << "redirect stdout to stdout " << _outId << endl;
    string s = "stdout";
    s += to_string(_outId);
    s += ".txt";
    if (path != "") s = path + s;
    auto r = freopen(s.c_str(), "w", stdout);
    if (r == nullptr) {
      cerr << "invalid output file " << s << endl;
      ;
      r = freopen("CON", "w", stdout);
    }
  }
}
const bool _local_test = false;
void solve() {
  int t = 1;
  if (_multi_test) cin >> t;
  if (_local_test) cerr << " now base " << base << endl;
  for (int i = 0; i < t; ++i) {
    if (_local_test) cerr << " tasks: " << i + 1 << endl;
    solve1();
  }
  int x = 1;
}
signed main(signed argc, char* argv[]) {
  if (_local_test) {
    if (argc == 1) {
      io_init(argv[0]);
    }
  }
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin.exceptions(cin.failbit);
  cout.precision(11);
  solve();
}
