#include <iostream>
#include<map>
#include<vector>
#include<climits>
#include<queue>
#include<cmath>
#include<string>
#include<algorithm>
#include<unordered_map>
#define pb push_back
#define N (lli)(1e9)
#define M (lli)(1e6)
#define lli long long int
#define mod (lli)(1e9+7)
#define INF LLONG_MAX
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
using namespace std;

int  main()
{

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	fast_io;

	int tes;
	cin >> tes;
	while (tes--)
	{
		int n, l, r;
		cin >> n >> l >> r;

		vector<int>left(n + 1);
		vector<int>right(n + 1);


		int x;
		for (int i = 1; i <= n; i++)
		{
			cin >> x;

			if (i <= l)
				left[x]++;
			else
				right[x]++;
		}

		int cost, mina, R, L, trem, rem, got, extra;
		R = 0;
		L = 0;
		extra = 0;
		cost = 0;

		for (int i = 1; i <= n; i++)
		{
			mina = min(left[i], right[i]);
			left[i] = left[i] - mina;
			right[i] = right[i] - mina;

			L = L + left[i];
			R = R + right[i];

		}

		mina = min(L, R);
		cost  = cost + mina;

		if (mina == L)
		{
			rem = R - mina;
			for (int i = 1; i <= n; i++)
			{
				if (rem == 0) break;
				got = right[i] / 2;
				trem = rem;
				rem = max(0, rem - 2 * got);
				cost = cost + (trem - rem) / 2;
			}

		}
		else
		{
			rem = L - mina;
			for (int i = 1; i <= n; i++)
			{
				if (rem == 0) break;
				got = left[i] / 2;
				trem = rem;
				rem = max(0, rem - 2 * got);
				cost = cost + (trem - rem) / 2;
			}


		}

		cost = cost + rem;
		cout << cost << endl;





	}
}
