#include <bits/stdc++.h>
using namespace std;
int arr[20][20] = {{0,  1,  2,   4,   7,   12,  20,  29,  38,  52,
                    73, 94, 127, 151, 181, 211, 257, 315, 373, 443},
                   {1,  0,  3,   5,   8,   13,  21,  30,  39,  53,
                    74, 95, 128, 152, 182, 212, 258, 316, 374, 444},
                   {2,  3,  0,   6,   9,   14,  22,  31,  40,  54,
                    75, 96, 129, 153, 183, 213, 259, 317, 375, 445},
                   {4,  5,  6,   0,   11,  16,  24,  33,  42,  56,
                    77, 98, 131, 155, 185, 215, 261, 319, 377, 447},
                   {7,  8,   9,   11,  0,   19,  27,  36,  45,  59,
                    80, 101, 134, 158, 188, 218, 264, 322, 380, 450},
                   {12, 13,  14,  16,  19,  0,   32,  41,  50,  64,
                    85, 106, 139, 163, 193, 223, 269, 327, 385, 455},
                   {20, 21,  22,  24,  27,  32,  0,   49,  58,  72,
                    93, 114, 147, 171, 201, 231, 277, 335, 393, 463},
                   {29,  30,  31,  33,  36,  41,  49,  0,   67,  81,
                    102, 123, 156, 180, 210, 240, 286, 344, 402, 472},
                   {38,  39,  40,  42,  45,  50,  58,  67,  0,   90,
                    111, 132, 165, 189, 219, 249, 295, 353, 411, 481},
                   {52,  53,  54,  56,  59,  64,  72,  81,  90,  0,
                    125, 146, 179, 203, 233, 263, 309, 367, 425, 495},
                   {73, 74,  75,  77,  80,  85,  93,  102, 111, 125,
                    0,  167, 200, 224, 254, 284, 330, 388, 446, 516},
                   {94,  95, 96,  98,  101, 106, 114, 123, 132, 146,
                    167, 0,  221, 245, 275, 305, 351, 409, 467, 537},
                   {127, 128, 129, 131, 134, 139, 147, 156, 165, 179,
                    200, 221, 0,   278, 308, 338, 384, 442, 500, 570},
                   {151, 152, 153, 155, 158, 163, 171, 180, 189, 203,
                    224, 245, 278, 0,   332, 362, 408, 466, 524, 594},
                   {181, 182, 183, 185, 188, 193, 201, 210, 219, 233,
                    254, 275, 308, 332, 0,   392, 438, 496, 554, 624},
                   {211, 212, 213, 215, 218, 223, 231, 240, 249, 263,
                    284, 305, 338, 362, 392, 0,   468, 526, 584, 654},
                   {257, 258, 259, 261, 264, 269, 277, 286, 295, 309,
                    330, 351, 384, 408, 438, 468, 0,   572, 630, 700},
                   {315, 316, 317, 319, 322, 327, 335, 344, 353, 367,
                    388, 409, 442, 466, 496, 526, 572, 0,   688, 758},
                   {373, 374, 375, 377, 380, 385, 393, 402, 411, 425,
                    446, 467, 500, 524, 554, 584, 630, 688, 0,   816},
                   {443, 444, 445, 447, 450, 455, 463, 472, 481, 495,
                    516, 537, 570, 594, 624, 654, 700, 758, 816, 0}};
int n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cout << arr[i][j] << " ";
    }
    cout << endl;
  }
  return 0;
}
