#include<bits/stdc++.h>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int n,l,r,a,cost=0;
		cin>>n>>l>>r;
		int left[n+5],right[n+5];
		memset(left,0,sizeof(left));
		memset(right,0,sizeof(right));
		for(int i=0;i<l;i++){
			cin>>a;
			left[a]++;
		}
		for(int i=0;i<r;i++){
			cin>>a;
			right[a]++;
		}
		for(int i=1;i<=n;i++){
			if(left[i]>=right[i]){
				left[i]-=right[i];
				right[i]=0;
			}
			else{
				right[i]-=left[i];
				left[i]=0;
			}
		}
		l=0,r=0;
		for(int i=1;i<=n;i++){
			if(left[i])
			l+=left[i];
			if(right[i])
			r+=right[i];
		}
		for(int i=1;i<=n;i++){
			while(l>r&&left[i]>=2){
				cost++;
				left[i]-=2;
				l-=2;
			}
			while(r>l&&right[i]>=2){
				cost++;
				right[i]-=2;
				r-=2;
			}
		}
		l=0,r=0;
		for(int i=1;i<=n;i++){
			if(left[i])
			l+=left[i];
			if(right[i])
			r+=right[i];
		}
		cost=cost+abs(r-l)/2+(l+r)/2;
		cout<<cost<<endl;
	}
}