Олимпиадный тренинг

Задача 38199. Endless table


The natural numbers are written in an (infinite) table, as shown.


It is required to display all its neighbors for a given number (the numbers written in the cells above, on the right, on the left and below, if any)

Input
One natural number not exceeding 109.

Imprint
The program should display all the numbers written in adjacent cells with the data, in ascending order. Numbers must be separated by a space.
Examples
# Input Output
1 1 3
2 7 3 6 8 13