#include <bits/stdc++.h>
using namespace std;
template <typename T>
void print(T a, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << a;
}
static void print(long long a, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << a << "LL";
}
static void print(string a, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << '"' << a << '"';
}
template <typename T, typename W>
void print(pair<T, W> P, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << "(";
  print(P.first);
  cerr << ",";
  print(P.second);
  cerr << ")";
}
template <typename T>
void print(vector<T> a, string name = "") {
  if (name != "") cerr << name << ":";
  cerr << "{";
  for (int i = 0; i != a.size(); i++) {
    if (i != 0) cerr << ", ";
    print(a[i]);
  }
  cerr << "}" << endl;
}
void printBits(unsigned int x, int end = 32, int start = 0) {
  for (int i = end - 1; i >= start; i--)
    if (x & (1 << i))
      cout << 1 << " ";
    else
      cout << 0 << " ";
}
template <typename T>
void printEndl(T x, string name = "") {
  print(x, name);
  cerr << endl;
}
template <typename T>
vector<T> tokenize(string s, string delim) {
  int i = 0, j = 0;
  vector<T> ret;
  for (; i < s.size(); ++i) {
    j = s.find_first_of(delim, i);
    if (j == -1) j = s.size();
    if (j > i) {
      stringstream in(s.substr(i, j - i));
      T temp;
      in >> temp;
      ret.push_back(temp);
    }
    i = j;
  }
  return ret;
}
template <typename T>
T gcd(T a, T b) {
  return a ? gcd(b % a, a) : b;
}
int bitCount(int x) { return __builtin_popcount(x); }
long long int two(int x) { return (1LL << x); }
bool test(long long int mask, int x) { return (mask & two(x)) > 0; }
template <typename T>
bool checkMax(T& ret, T& cur) {
  if (ret < cur) {
    ret = cur;
    return true;
  }
  return false;
}
template <typename T>
bool checkMin(T& ret, T& cur) {
  if (ret > cur) {
    ret = cur;
    return true;
  }
  return false;
}
const char eof = -123;
int readInt() {
  int x;
  if (scanf("%d", &x) != 1) return eof;
  return x;
}
char readChar() {
  char c;
  if (scanf("%c", &c) != 1) return eof;
  return c;
}
long long int readLL() {
  long long int x;
  if (cin >> x) return x;
  return eof;
}
double readDouble() {
  double f;
  if (scanf("%lf", &f) == 1) return f;
  return eof;
}
int c[22][22];
int memo[1 << 20][20];
int least(int mask, int x) {
  if (mask == 0) return c[x][0];
  int& ret = memo[mask][x];
  if (ret != -1) return ret;
  ret = (1 << 30);
  for (int i = 0; i < (20); ++i)
    if (mask & (1 << i)) ret = min(ret, least(mask - (1 << i), i) + c[x][i]);
  return ret;
}
int highest(int mask, int x) {
  if (mask == 0) return c[x][0];
  int& ret = memo[mask][x];
  if (ret != -1) return ret;
  ret = 0;
  for (int i = 0; i < (20); ++i)
    if (mask & (1 << i)) ret = max(ret, highest(mask - (1 << i), i) + c[x][i]);
  return ret;
}
void verify(int n) {
  memset(memo, -1, sizeof(memo));
  int x = least((1 << n) - 2, 0);
  cout << " least = " << x << endl;
  memset(memo, -1, sizeof(memo));
  int y = highest((1 << n) - 2, 0);
  cout << " highest = " << y << endl;
  assert(x == y);
  vector<int> seen(1001, 0);
  for (int i = 0; i < (n); ++i) {
    assert(c[i][i] == 0);
    for (int j = 0; j < (i); ++j) {
      assert(!seen[c[i][j]]);
      seen[c[i][j]] = 1;
    }
  }
}
int seen[100000];
void goPoly() {
  c[0][1] = c[1][0] = 1;
  c[0][2] = c[2][0] = 2;
  c[1][2] = c[2][1] = 3;
  seen[1] = seen[2] = seen[3] = 1;
  for (int n = 4; n <= 20; ++n) {
    bool found = false;
    for (int t = 1; t <= 998; ++t) {
      if (seen[t] || seen[t + 1] || seen[t + 2]) continue;
      bool good = true;
      vector<int> v(n - 1, 0);
      v[0] = t;
      v[1] = t + 1;
      v[2] = t + 2;
      int constant = v[0] + v[1] - c[0][1];
      for (int i = 3; i < n - 1; ++i) {
        v[i] = constant + c[i][0] - v[0];
        if (seen[v[i]]) {
          good = false;
          break;
        }
      }
      if (!good) continue;
      for (int i = 0; i < n - 1; ++i) c[n - 1][i] = c[i][n - 1] = v[i];
      if (good) {
        found = true;
        for (int i = 0; i < ((n - 1)); ++i) seen[v[i]] = 1;
        break;
      }
    }
  }
}
int main() {
  goPoly();
  int k = readInt();
  for (int i = 0; i < (k); ++i) {
    for (int j = 0; j < (k); ++j) {
      if (j) cout << " ";
      cout << c[i][j];
    }
    cout << endl;
  }
}
