quadra = []


def cria_quadra(tam):
    for i in range(tam):
        lin = []
        for j in range(tam):
            lin.append(j)
        quadra.append(lin)
    print(quadra)


def imprime():
    for i in range(len(quadra)):
        for j in range(len(quadra[i])):
            print(j, end=' ')
        print()


tam = int(input())
cria_quadra(tam)
imprime()

b2b1709c86e4c11dc7aad8e763b9acc4d3c11393
<mask token>


def cria_quadra(tam):
    for i in range(tam):
        lin = []
        for j in range(tam):
            lin.append(j)
        quadra.append(lin)
    print(quadra)


<mask token>

<mask token>


def cria_quadra(tam):
    for i in range(tam):
        lin = []
        for j in range(tam):
            lin.append(j)
        quadra.append(lin)
    print(quadra)


def imprime():
    for i in range(len(quadra)):
        for j in range(len(quadra[i])):
            print(j, end=' ')
        print()


<mask token>

<mask token>


def cria_quadra(tam):
    for i in range(tam):
        lin = []
        for j in range(tam):
            lin.append(j)
        quadra.append(lin)
    print(quadra)


def imprime():
    for i in range(len(quadra)):
        for j in range(len(quadra[i])):
            print(j, end=' ')
        print()


<mask token>
cria_quadra(tam)
imprime()

quadra = []


def cria_quadra(tam):
    for i in range(tam):
        lin = []
        for j in range(tam):
            lin.append(j)
        quadra.append(lin)
    print(quadra)


def imprime():
    for i in range(len(quadra)):
        for j in range(len(quadra[i])):
            print(j, end=' ')
        print()


tam = int(input())
cria_quadra(tam)
imprime()
