#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const int inf = 1e9;
const ll infll = 1e18;
const int M = 1000000007;
const int N = 1e5;

void resizeVectors(vector<int> &L, vector<int> &R, int &l , int &r){
	vector<int> tmpL, tmpR;
	for(auto x : L){
		if(x+1) tmpL.pb(x);
	}
	for(auto x : R){
		if(x+1) tmpR.pb(x);
	}

	L = tmpL;
	R = tmpR;

	l = L.size();
	r = R.size();
}

void testCase(){
	int n , l , r;
	scanf("%d%d%d",&n,&l,&r);
	vector<int> L, R;
	for (int i = 0; i < l; ++i){
		int x;
		scanf("%d", &x);
		L.pb(x);
	}
	for (int i = 0; i < r; ++i){
		int x;
		scanf("%d", &x);
		R.pb(x);
	}
	if(l > r){
		swap(l, r);
		swap(L, R);
	}
	sort(all(L));
	sort(all(R));
	int i = 0 , j = 0;
	while(i < l && j < r){
		if(L[i] == R[j]){
			L[i++] = -1;
			R[j++] = -1;
			continue;
		}
		if(L[i] < R[j]) ++i;
		else ++j;
	}
	//cout << l << " " << r << endl;
	resizeVectors(L, R, l , r);
	//cout << l << " " << r << endl;
	int times = (r - l)/2;
	int ans = l;
	for (int i = 1; i < r; ++i){
		if(R[i] == R[i-1] && times){
			R[i] = R[i-1] = -1;
			--times;
			++ans;
		} 	
	} 
	ans += times*2;
	printf("%d\n", ans);
}

int main(){
	int T = 1;
	scanf("%d", &T);
	while(T--){
		testCase();
	} 
}	