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

#define ll long long
#define pb push_back
#define LINF LONG_LONG_MAX
#define INF INT_MAX
#define MAX *max_element
#define SPEED ios_base::sync_with_stdio(0);cin.tie(0);

void solve()
{
    int n,l,r;
    cin>>n>>l>>r;
    int arr[n];
    vector<int> mpl(n+1,0);
    vector<int> mpr(n+1,0);
    for(int i=0;i<n;i++)
    {
        cin>>arr[i];
        if(i<l)
        {
            mpl[arr[i]]++;
        }
        else
        {
            mpr[arr[i]]++;
        }
    }
    int temp;
    for(int i=0;i<=n;i++)
    {   
        temp=min(mpl[i],mpr[i]);
        mpl[i]-=temp;
        mpr[i]-=temp;
    }
    if(l<r)
    {
        swap(l,r);
        int x;
        for(int i=0;i<=n;i++)
        {
            x=mpl[i];
            mpl[i]=mpr[i];
            mpr[i]=x;
        }  
    }
    int red=(l-r)/2;
    int ans=0;
    int an=0;
    for(int i=0;i<=n;i++)
    {
        int t;
        if(red>=mpl[i]/2)
        {
            t=mpl[i]/2;
            an+=t;
            red-=t;
            mpl[i]-=t;
            mpr[i]+=t;
        }
        else
        {
            an+=red;
            mpl[i]-=red;
            mpr[i]+=red;
            red=0;
            break;
        }
    }
    
    for(int i=0;i<=n;i++)
    {
        ans+=abs(mpl[i]-mpr[i]);
    }  
    ans=ans/2; 
    cout<<ans+an+red<<"\n";
}

int main()
{
    SPEED
    int tc=1;
    cin>>tc;
    while(tc--)
    {
        solve();        
    }
    return 0;
}
