Limits 1s, 512 MB

Minas is working on his new language. He want to add a feature call expandable listview. Here he explains how it works.

  1. It should have some parent node and there should have some child node under parent node.
  2. First only parent row are visible. If any parent row is clicked child row should be visible if its child are not visible otherwise child’s should be hidden. Each click in parent row toggled the visibility of child row. No effect on child row click. Main problem in his implementation is row id’s change when a parent row is clicked.

You can see that after clicking on parent_1, id of parent_2 and parent_3 is changed.

Now Minas will give you the number of parent node and their corresponding number of child node. There will be some query each query Minas will give you ID of the clicked node. You need to tell it is parent node or child node and do the clicked operation.

Input

Input starts with an integer TT (T30T \le 30) denoting the number of test cases. Each case starts with a line containing an integer nn (n100000n \le 100000) denoting number of parent node. Each of the next lines containing nn integers aia_i (1ai100001 \le a_i \le 10000, 1in1 \le i \le n) denoting number of child node for ii-th parent. Next Line contain an integer qq (1q100001 \le q \le 10000) denoting number of queries. Next qq line contain one integer xx (1xnumber of visible row1 \le x \le \text{number of visible row}) denoting ID of clicked node.

Output

For each case, print the case number and for each query print “Parent” if clicked node is parent otherwise print “Child”.

Sample

InputOutput
1
3
2 2 2
5
1
2
4
1
2
Case 1:
Parent
Child
Parent
Parent
Parent

Submit

Login to submit.

Statistics

91% Solution Ratio
AashiqEarliest, Jan '17
nusuBotFastest, 0.2s
sinamhdvLightest, 2.6 MB
seyedsszShortest, 1508B
Toph uses cookies. By continuing you agree to our Cookie Policy.