#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;
void testcase(){
	int n, l, r;
	cin >> n >> l >> r;
	vector<int> f(n); //{left : -1, right : +1}
	for(int i = 0; i < l; i++){
		int x;
		cin >> x;
		--f[--x];
	}
	for(int i = 0; i < r; i++){
		int x;
		cin >> x;
		++f[--x];
	}
	
	int neg = 0, pos = 0;
	for(int x: f){
		if(x > 0){
			pos += x;
		}
		else if(x < 0){
			neg -= x;
		}
	}
	
	if(neg > pos){
		for(int& x: f){
			x = -x;
		}
		swap(neg, pos);
	}
	
	int ans = 0;
	for(int& x: f){
		if(neg == 0)
			break;
		if(x > 0 && (x & 1)){
			--neg;
			--x;
			++ans;
		}
	}
	
	for(int& x: f){
		if(x > 0){
			int sub = min(neg, x);
			assert(sub % 2 == 0);
			x -= sub;
			neg -= sub;
			ans += sub;
		}
	}
	
	int cnt = 0;
	for(int& x: f){
		if(x > 0){
			ans += x/2;
			cnt += (x & 1);
		}
	}
	
	assert(cnt % 2 == 0);
	ans += cnt;
	
	cout << ans << '\n';
	
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t;
	cin >> t;
	while(t--){
		testcase();
	}
}

//[f: [-1, 2, -1, 0, 0, 0]] 
//[f: [-2, 4, 0, 0, 0, 0]] 
//[f: [1, -1, -1, -1, -1, -1]] 
//[f: [0, 0, 1, 3]]
