N = gets.to_i

@ans = Array.new(N){Array.new}

def decide(rooms, lv)
	if rooms.size == 1
		return
	end
	if rooms.size == 2
		i, j = rooms
		@ans[i][j] = lv
	end
	rooms1 = Array.new
	rooms2 = Array.new
	rooms.each_with_index do |room, i|
		if i % 2 == 0
			rooms1.push(room)
		else
			rooms2.push(room)
		end
	end
	rooms1.each do |i|
		rooms2.each do |j|
			if i < j
				@ans[i][j] = lv
			else
				@ans[j][i] = lv
			end
		end
	end
	decide(rooms1, lv + 1)
	decide(rooms2, lv + 1)
end
decide((0..(N - 1)).to_a, 1)
puts @ans.collect{|line| line.compact.join(' ')}