#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define vec vector
#define psb push_back
#define ppb pop_back
#define mkp make_pair
#define fst first
#define scd second
#define ins insert
#define psf push_front
#define ppf pop_front
using namespace std;
int main() {
	ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int t, n, l, r, i, x, ans;
	cin >> t;
	while(t--) {
		cin >> n >> l >> r;
		map<int, int> left, right;
		for(i = 0; i < l; i++) {
			cin >> x;
			left[x]++;
		}
		for(i = 0; i < r; i++) {
			cin >> x;
			right[x]++;
		}
		for(auto it : left) {
			if(right.find(it.fst) != right.end()) {
				x = min(left[it.fst], right[it.fst]);
				left[it.fst] -= x;
				right[it.fst] -= x;
			}
		}
		map<int, int> &lar = (r > l ? right : left);
		x = (max(r, l) - min(r, l)) >> 1;
		ans = 0;
		for(auto it : lar) {
			while(it.scd > 1 && x > 0) {
				it.scd -= 2;
				x--;
				ans++;
			}
			ans += it.scd;
		}
		cout << ans << '\n';
	}
	return 0;
}
