
// 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
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <iostream>

//  remove_if, sort, min, max, reverse,  merge, binary_search, is_sorted, unique, replace_if, count, push_heap, pop_heap, make_heap
#include <algorithm>
#include <vector>
// .push, .pop, .front, .back
#include <queue>
// .front, .back, .push_back, push_front, pop_back, pop_front, .at (slow)
#include <deque>
// map<string, int> m; m["x"] = 2; auto it = m.find("x"); it != m.end(); it->second; m.erase(it); m.erase("x");
#include <map>
// can take custom binary cmp function,
// set<string> a; a.insert("f"); set<string>iterator it = a.find("f); it != a.end(); *it; a.erase("f");
#include <set>
#include <cstdio> // printf, scanf // scanf("%d", &i); // read integer
#include <stdlib.h>
#include <assert.h> // assert
#include <utility>  // pair, make_pair
#include <functional>
#include <string>
#include <stack>  // .pop .push .size .top .empty
#include <math.h> // cos, sin, tan, acos, asin, atan2, exp, log, log10, log2, pow, sqrt, hypot, cell, floor, round, fabs, abs

using namespace std;
#define speed ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define ll long long int
#define fo(i, n) for (int i = 0; i < n; i++)
#define fab(i, a, b) for (int i = a; i < b; i++)
#define rfo(i, n) for (int i = n; i > 0; i--)

//pair
#define pii pair<int, int>
#define F first
#define S second

// vector
#define pb(x) push_back(x)

using namespace std;

const ll N = 2e5 + 10;
const ll M = 2e5 + 1;
const ll big = 1e18;
const ll hsh2 = 1964325029;
const long long mod = 1e9 + 7;
const long double EPS = 1e-14;
const ll block = 1e7;
const ll shift = 2e3;

void solve(int i)
{

    ll n, l, r;
    cin >> n >> l >> r;
    vector<ll> v;
    map<ll, ll> lc, lr;
    
    
    fo(i, l)
    {
        ll x;
        cin >> x;
        v.pb(x);
        
        lc[x]++;
    }
    
    fo(i,r){
    	ll x;
        cin >> x;
        v.pb(x);
        
        lr[x]++;
    	
    }
    ll cnt = abs(l - r) / 2;

    if (l == r)
    {

        for (auto it : lc)
        {
            if (it.S > lr[it.F])
            {
                cnt += lc[it.F] - lr[it.F];
            }
        }
        cout << cnt << endl;
    }

    else if (l > r)
    {

        ll k = cnt;
        for (auto it : lc)
        {
            if (it.S > lr[it.F] + 1)
            {
                ll temp = min((lc[it.F] - lr[it.F]) / 2, k);
                lr[it.F] += temp;
                lc[it.F] -= temp;
                k -= temp;
            }
            if (k == 0)
                break;
        }
        for (auto it : lc)
        {
            if (k == 0)
                break;
            if (it.S == lr[it.F] + 1)
            {
                ll temp = min((ll)1, k);
                lr[it.F] += temp;
                lc[it.F] -= temp;
                k -= temp;
            }
        }
        for (auto it : lc)
        {
            if (it.S > lr[it.F])
            {
                cnt += lc[it.F] - lr[it.F];
            }
        }
        cout << cnt << endl;
    }
    else if (l < r)
    {
        // cnt+=(r-l)/2;
        ll k = cnt;

        for (auto it : lr)
        {

            if (it.S > lc[it.F] + 1)
            {
                ll temp = min((lr[it.F] - lc[it.F]) / 2, k);
                lc[it.F] += temp;
                lr[it.F] -= temp;
                k -= temp;
            }
        }

        for (auto it : lr)
        {
            if (k == 0)
                break;
            if (it.S == lc[it.F] + 1)
            {
                ll temp = min((ll)1, k);
                lc[it.F] += temp;
                lr[it.F] -= temp;
                k -= temp;
            }
        }
        for (auto it : lr)
        {
            if (it.S > lc[it.F])
            {
                cnt += lr[it.F] - lc[it.F];
            }
        }
        cout << cnt << endl;
    }

    // cout<<"Case #"<<i<<": "<<""<<endl;
}

int main()
{
    speed;

    ll t;
    cin >> t;
    int i = 1;
    while (t--)
    {
        solve(i);
        i++;
    }
    return 0;
}
