// Problem: D. Phoenix and Socks
// Contest: Codeforces - Codeforces Global Round 14
// URL: https://codeforces.com/contest/1515/problem/D
// Memory Limit: 256 MB
// Time Limit: 2000 ms

#include <bits/stdc++.h>
using namespace std;

const int N = 2e5 + 10;

int cnt[N];
void solve() {
	int n, l, r, ans = 0;
	cin >> n >> l >> r;
	for (int i = 1; i <= n; ++i) {
		cnt[i] = 0;
	}
	for (int i = 1; i <= l; ++i) {
		int col;
		cin >> col;
		++cnt[col];
	}
	for (int i = 1; i <= r; ++i) {
		int col;
		cin >> col;
		--cnt[col];
	}
	stack<int> lo, le, ro, re;
	for (int i = 1; i <= n; ++i) {
		if (cnt[i] > 0) (cnt[i] % 2 == 1 ? lo : le).push(i);
		if (cnt[i] < 0) ((-cnt[i]) % 2 == 1 ? ro : re).push(i);
	}
	while (!lo.empty() && !ro.empty()) {
		--cnt[lo.top()], ++cnt[ro.top()];
		lo.pop(), ro.pop();
		++ans;
	}
	int suml = 0, sumr = 0;
	for (int i = 1; i <= n; ++i) {
		if (cnt[i] > 0) suml += cnt[i] / 2 * 2;
		if (cnt[i] < 0) sumr += (-cnt[i]) / 2 * 2;
	}
	if (lo.size() > sumr) {
		ans += lo.size();
		ans += suml / 2;
	}
	else if (ro.size() > suml) {
		ans += ro.size();
		ans += sumr / 2;
	}
	else {
		suml += lo.size();
		sumr += ro.size();
		ans += (suml + sumr) / 2;
	}
	cout << ans << endl;
	return;
}
int main() {
	int T;
	cin >> T;
	while (T--) solve();
	return 0;
}