Endless table
Problem
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 data: Enter one natural number not exceeding 10
9.
Output: The program should output all the numbers written in adjacent data cells in ascending order. Numbers must be separated by spaces.
Examples
| # |
Input |
Output |
| 1 |
1 |
3 |
| 2 |
7 |
3 6 8 13 |
Запрещенные операторы: for; while; until