#SGM0000022. Xóa phần tử khỏi danh sách (List Removals)
Xóa phần tử khỏi danh sách (List Removals)
List Removals
Source: CSES
Version: Phuoc Hung OJ Extended
Problem Statement
You are given a list of integers. During the process, if the current list has elements, they are numbered from to in their current order.
There are exactly removals. At removal , remove the element currently at position and print its value.
Input
The first line contains .
The second line contains .
The third line contains , where .
Output
Print the removed values in order.
Subtasks
- Subtask 1 — 20%: .
- Subtask 2 — 30%: .
- Subtask 3 — 50%: , .
Examples
Input
5
2 6 1 4 2
3 1 3 1 1
Output
1 2 2 6 4
Explanation
The sample is processed in order; every printed item/line corresponds to an operation that requires output.