package main import ( "fmt" "math" "strings" ) func main() { var k int _, _ = fmt.Scan(&k) l := int(math.Pow(2, float64(k))) - 1 h := 3 * k a := "" for { s := int(math.Max(float64(l-h), 0)) for i := s + 1; i <= l; i++ { a += fmt.Sprintf("%d ", i) } if l-h <= 0 { break } l, h = l-h, h-1 } fmt.Println(strings.Trim(a, " ")) }