403072: GYM100989 J Objects Panel (A)

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

J. Objects Panel (A)time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Raihan is helping Maram and Master Hasan in the design of their graduation project. They have a panel that shows a list of the objects created by the user. Objects can be nested inside each other, the user can click the '-' sign to collapse the items nested inside an object, or click the '+' sign to expand the objects nested inside it.

Check the following table for more details:

Note that all objects are nested inside a list item called project.

For each object in the project, you are given a list of objects nested inside it and whether it’s expanded or collapsed. Can you help Raihan in drawing the panel?

Input

The first line of input contains an integer N (0 ≤ N ≤ 100), the number of objects in the project. Objects are numbered from 1 to N. The project item is item number 0.

Each of the following N + 1 lines contains the description of an object. The ith (starting from 0) line describes the object number i in the following format:

S K A1 A2 ... AK

Where S is the state of the object (expanded or collapsed), where '-' means it's expanded and '+' means it's collapsed. The state of objects that do not have any nested objects will be '-'.

K is the number of objects nested inside this object, this number is followed by K distinct numbers representing the numbers of the nested objects.

Output

Output the current state of the list, the items nested in an object should be listed in the given order.

An object inside another is nested by two spaces, the first space is replaced with '+' or '-' depending on the state of the object, if the object does not have other objects inside it, then keep the space.

ExamplesInput
6
- 3 2 5 1
+ 1 3
- 1 6
- 1 4
- 0
- 0
- 0
Output
- project
- object2
object6
object5
+ object1
Input
0
- 0
Output
  project

加入题单

上一题 下一题 算法标签: