Snakes!

Write a program that reads a sequence of snakes, and prints them one
after another.

Input

Input consists of a sequence of snake definitions, each one in a line.
Each definitions starts with two natural numbers: c is the column where
starts the snake; n is the number of times that changes of sense (from
right to left or from left to right). After n numbers come p₁, …, p_(n)
indicating in which rows changes of sense. Finally, a natural r comes
indicating the row where has the eyes.

The rows and the columns start in 1. Assume that 0 < p₁ < … < p_(n) < r,
and that the snake never goes out of the left side. Each snake starts
moving to the right.

Output

Print the snakes as it is shown in the instance, separating them with a
space.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T11:15:28.198Z

© Jutge.org, 2006–2026.
https://jutge.org
