#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);

	int t;
	cin >> t;
	for (int cs = 1; cs <= t; cs++)
	{
		int n, l, r;
		cin >> n >> l >> r;
		vector<int> left_dist(n);
		vector<int> right_dist(n);
		fill(left_dist.begin(), left_dist.end(), 0);
		fill(right_dist.begin(), right_dist.end(), 0);
		for (int i = 0; i < l; i++)
		{
			int c;
			cin >> c;
			c--;
			left_dist[c]++;
		}
		for (int i = 0; i < r; i++)
		{
			int c;
			cin >> c;
			c--;
			right_dist[c]++;
		}
		//int left_orphans = 0;
		//int right_orphans = 0;
		int total_cost = 0;
		for (int i = 0; i < n; i++)
		{
			int &ld = left_dist[i];
			int &rd = right_dist[i];
			const int mn = min(ld, rd);
			ld -= mn;
			l -= mn;
			rd -= mn;
			r -= mn;
			while (l > r && ld >= 2)
			{
				total_cost++;
				ld -= 2;
				l -= 2;
			}
			while (l < r && rd >= 2)
			{
				total_cost++;
				rd -= 2;
				r -= 2;
			}
			/*
			total_cost += ld / 2 + rd / 2;
			ld %= 2;
			rd %= 2;
			left_orphans += ld;
			right_orphans += rd;
			*/
		}
		const int mn = min(l, r);
		total_cost += mn;
		l -= mn;
		r -= mn;
		total_cost += l + r;
		cout << total_cost << '\n';
	}

	return EXIT_SUCCESS;
}
