def hexadecimal(n):
    if (n < 0):
        print(0)
    elif (n<=1):
        print("")
    else:
        x =(n%16)
        if (x < 10):
            print(x),
        if (x == 10):
            print("A"),
        if (x == 11):
            print("B"),
        if (x == 12):
            print("C"),
        if (x == 13):
            print("D"),
        if (x == 14):
            print("E"),
        if (x == 15):
            print ("F"),
        hexadecimal( n / 16 )
def binary(number):
    list=[]
    number = int(number)
    while(number!=0 and type(number%2)==type(2)):
        list.append(number%2)
        number=int(number/2)
    list=list[::-1]
    string=""
    for i in range(len(list)):
        string = string+str(list[i])
    list=str.split(string)
    integer=0
    try:
        integer = int(list[0])
    except:
        integer=0
    return(integer)

def thickness(number):
    return(len(str(binary(number))))

def blank_calculator(final_thickness,input):
    this_thickness=len(str(binary(input)))
    net = final_thickness-this_thickness
    blank=""
    for i in range(net):
        blank = blank + " "
    return blank

input=int(input())

thickness = thickness(input)
for i in range(input):
    blank= blank_calculator(thickness,i)
    hexa=((hex(i).split('x')[1]).upper())
    print(hexa,blank," ",binary(i))

