A list of integers is given. Then $Q$ indices follow, each always valid for the current list (negative indices allowed). For each index remove and print the popped value (one per line), then on the last line print the final list as a Python list literal.
Input
Line 1: the list. Line 2: $Q$. Next $Q$ lines: an index each.
Output
Print each popped value, then the final list.
Example 1
Input
10 20 30 40 50 3 1 -1 0
Output
20 50 10 [30, 40]
Discussion
Threads about this problem. Spoilers are collapsed; wrap hints in
||double bars||.No discussion yet. Start a thread if something here needs explaining.