#C10693. Final Order of Participants
Final Order of Participants
Final Order of Participants
In this problem, you are given a list of participants and a list of cancellations for multiple test cases. For each test case, you must determine the final order of participants after removing those who cancelled.
The input begins with an integer (T) representing the number of test cases. For each test case, a positive integer (N) is given, indicating the number of participants. This is followed by (N) integers representing the initial order of participants. Then, an integer (K) is provided, followed by (K) integers representing the participants that cancelled.
Your task is to output the final order of participants for each test case. The final order must preserve the order of the original list after removing the cancelled participants. If all participants are cancelled, output an empty line.
inputFormat
The input is read from standard input (stdin) and has the following format:
(T)
For each test case:
(N)
A line with (N) integers separated by spaces denoting the initial order of participants
(K)
A line with (K) integers separated by spaces representing the cancelled participants (if (K = 0), this line may be empty)
outputFormat
For each test case, output a single line on standard output (stdout) containing the final order of participants separated by a single space. If no participant remains after cancellations, output an empty line.## sample
3
5
1 2 3 4 5
2
2 4
4
1 3 5 7
1
5
6
2 4 6 1 3 5
4
6 3 1 4
1 3 5
1 3 7
2 5
</p>