#include <bits/stdc++.h>

using namespace std;

#ifdef NeverBeRed
#include "debug.h"
#else
#define debug(...) 9715
#endif
typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define F first
#define S second



int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0);

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

		map<int, int> a, b;
		for (int i = 0, x; i < l; ++i)
		{
			cin >> x;
			++a[x];
		}

		for (int i = 0, x; i < r; ++i)
		{
			cin >> x;
			if (a[x])
			{
				--a[x];
				continue;
			}
			++b[x];
		}

		int sa = 0, sb = 0;
		for (auto i : a) sa += i.S;
		for (auto i : b) sb += i.S;
		if (sa < sb)
			a.swap(b), swap(sa, sb);
		
		int c = 0;
		for (auto i : a)
			c += i.S / 2;
		
		int k = min(c, (sa - sb) / 2);
		sa -= 2 * k;
		cout << k + sa << "\n";
	}

	return 0;
}
