import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto N = readln.chomp.to!int;
    auto G = new int[][](N, N);

    DList!int red;
    DList!int blue;

    foreach (i; 0..bsr(N)+1) {
        red.clear;
        blue.clear;
        foreach (j; 0..N) (((j >> i) & 1) ? red : blue).insertBack(j);
        foreach (r; red) foreach (b; blue) if (G[r][b] == 0) G[r][b] = G[b][r] = i + 1;
    }

    N.iota.each!(i => G[i][i+1..$].map!(to!string).join(" ").writeln);
}