You are given two multiset $$$s,t$$$ of size $$$n$$$.
You can do the following operation:
Determine if you can make $$$s$$$ and $$$t$$$ both empty sets through several operations.
The first line of input will contain a single integer $$$t(1 \leq t \leq 10^5)$$$, denoting the number of test cases.
Each test cases contains three lines.
The first line contains an integer $$$n(1 \leq n \leq 2*10^5)$$$.
The second line contains $$$n$$$ integers $$$x_1,x_2,...,x_n(1 \leq x_i \leq 2n)$$$,denoting the integers in $$$s$$$.
The third line contains $$$n$$$ integers $$$y_1,y_2,...,y_n(1 \leq y_i \leq 2n)$$$,denoting the integers in $$$t$$$.
The sum of $$$n$$$ over all test cases will not exceed $$$2*10^5$$$.
For each test case,output on a new line — if you can make $$$s$$$ and $$$t$$$ both empty sets through several operations,output $$$YES$$$.Otherwise,output $$$NO$$$.
2 3 1 1 2 3 3 2 3 1 1 1 1 1 1
YES NO
Test case $$$1$$$:
Initially,$$$s=\{1,1,2\},t=\{3,3,2\}$$$.
Operation $$$1$$$:Remove $$$1$$$ from $$$s$$$ and remove $$$3$$$ from $$$t$$$.Now $$$s=\{1,2\},t=\{3,2\}$$$.
Operation $$$2$$$:Remove $$$1$$$ from $$$s$$$ and remove $$$2$$$ from $$$t$$$.Now $$$s=\{2\},t=\{3\}$$$.
Operation $$$3$$$:Remove $$$2$$$ from $$$s$$$ and remove $$$3$$$ from $$$t$$$.Now $$$s$$$ and $$$t$$$ are both empty sets.
Test case $$$2$$$:
You can not make $$$s$$$ and $$$t$$$ both empty sets through several operations.
Name |
---|