#abc344b. B - Delimiter

B - Delimiter

Score: 150150 points

问题描述

你将获得 NN 个整数 A1,A2,,ANA_1,A_2,\dots,A_N,每行一个,分布在 NN 行中。但是,输入中并未给出 NN 的值

此外,以下条件得到保证:

  • Ai0A_i \neq 0 (对于 1iN11 \le i \le N-1
  • AN=0A_N = 0

按照这个顺序打印 AN,AN1,,A1A_N, A_{N-1},\dots,A_1

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given NN integers A1,A2,,ANA_1,A_2,\dots,A_N, one per line, over NN lines. However, NN is not given in the input.
Furthermore, the following is guaranteed:

  • Ai0A_i \neq 0 ( 1iN11 \le i \le N-1 )
  • AN=0A_N = 0

Print AN,AN1,,A1A_N, A_{N-1},\dots,A_1 in this order.

Constraints

  • All input values are integers.
  • 1N1001 \le N \le 100
  • 1Ai1091 \le A_i \le 10^9 ( 1iN11 \le i \le N-1 )
  • AN=0A_N = 0

Input

The input is given from Standard Input in the following format:

A1A_1

A2A_2

\vdots

ANA_N

Output

Print AN,AN1,,A1A_N, A_{N-1}, \dots, A_1 in this order, as integers, separated by newlines.

Sample Input 1

3
2
1
0

Sample Output 1

0
1
2
3

Note again that NN is not given in the input. Here, N=4N=4 and A=(3,2,1,0)A=(3,2,1,0).

Sample Input 2

0

Sample Output 2

0

A=(0)A=(0).

Sample Input 3

123
456
789
987
654
321
0

Sample Output 3

0
321
654
987
789
456
123
}