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

#define forn(i,m,n) for(ll i=m;i<n;i++)
#define vv vector
#define vi vv<int>
#define ii pair<int,int>
#define vii vv<ii>
#define mp make_pair
#define pb push_back
#define PI 3.141592653589
#define ll long long
#define pll pair<ll,ll>
#define vl vv<ll>
#define ff first
#define ss second
#define MOD 1000000007


bool is_prime[1000011];
vl prime;
void sieve(ll n)
{
    memset(is_prime,true,sizeof(is_prime));
    for(ll i=2;i*i<=n;i++)
    {
        if(is_prime[i])
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                is_prime[j]=false;
            }
        }
    }
    forn(i,2,n+1)
    {
        if(is_prime[i])
            prime.pb(i);
    }
}

ll ex(ll a,ll b)
{
    ll res=1;
    a=a%MOD;
    while(b)
    {
        if(b%2){res=(res*a)%MOD;b--;}
        b/=2;
        a=(a*a)%MOD;
    }
    return res;
}

ll fermat_inv(ll a){ return ex(a,MOD-2); }
ll max(ll a,ll b){ return a>b?a:b; }
ll min(ll a,ll b){ return a<b?a:b; }

ll gcd(ll a,ll b) { return (a%b==0)?b:gcd(b,a%b); }

ll fact[300005];
ll finv[300005];
void factorial(int n){
    fact[0]=1;
    finv[0]=1;
    for(ll i=1;i<=n;i++)
        fact[i]=fact[i-1]*i,fact[i]%=MOD,finv[i]=fermat_inv(fact[i]);
}
ll ncr(ll n,ll r)
{
    if(n<r)
        return 0;
    else{
        ll x=finv[r]*finv[n-r]%MOD;
        return fact[n]*x%MOD;
    }
}


void solve(){
    ll n,l,r,x;
    cin>>n>>l>>r;
    ll c[n+1][2];
    memset(c,0,sizeof(c));
    forn(i,0,l){
        cin>>x;
        c[x][0]++;
    }
    forn(i,0,r){
        cin>>x;
        c[x][1]++;
    }
    vl left,right;
    ll cost=0;
    ll suml=0,sumr=0;
    forn(i,1,n+1){
        ll j=c[i][0]-c[i][1];

        if(j>0){
            left.pb(j);
            suml+=j;
        }
        else if(j<0){
            j*=-1;
            right.pb(j);
            sumr+=j;
        }
    }
    cost+=min(suml,sumr);
    suml-=cost;
    sumr-=cost;
    ll copy2=suml;
    if(suml>0){
        for(auto v:left){
            suml-=(v/2)*2;
        }
    }
    //cout<<sumr<<"\n";
    ll copy1=sumr;
    if(sumr>0){
        for(auto v:right){
            //cout<<v<<"  <- v\n";
            sumr-=(v/2)*2;
        }
    }
    suml=max(suml,0);
    sumr=max(sumr,0);
    copy1-=sumr;
    copy2-=suml;
    cout<<cost+suml+sumr+copy1/2+copy2/2<<"\n";

}

int main()
{
    ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        #ifndef ONLINE_JUDGE
            freopen("input.txt", "r", stdin);
            freopen("output.txt", "w", stdout);
        #endif
    //sieve(1000010);
    //factorial(300005);

    int te;cin>>te;while(te--)
        solve();
}
