Page not loading? Try clicking here.
Placeholder

#5945

Number triangle 1 1s 32MB

Problems

Given the height 𝑛 of a triangle, write a program that prints the triangle in the following numeric pattern.

<Conditions>

In the first row, the numbers progress from left to right.

In the next row, the direction reverses, progressing from right to left.

Repeat this alternating pattern for each row, using numbers 1 and 2 up to 𝑛.


Input

The triangle height 𝑛 is given.

𝑛 is an odd integer between 1 and 50 inclusive.


Output

Print the triangle with height n. Numbers in each row are separated by a space.

If the input value is outside the specified range, output INPUT ERROR!.


Example #1

3
1 
3 2
4 5 6

Example #2

5
1
3 2
4 5 6
10 9 8 7
11 12 13 14 15


Source

JUNGOL

You must sign in to write code.