#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
       long long int n,l,r,ans=0,i;
       cin>>n>>l>>r;
       long long int a[n];
        map<long long int,long long int>mp;
       for(i=0;i<n;i++)
       {
           cin>>a[i];
       }
       for(i=0;i<l;i++)
       {
           mp[a[i]]--;
       }
       for(i=l;i<n;i++)
       {
           mp[a[i]]++;
       }
       long long int le=0,ri=0,left=0,right=0;
       for(auto x:mp)
       {
           if(x.second<0)
           {
           left+=abs(x.second);
           }
           else
           {
           right+=abs(x.second);
           }
          if(x.second<0&&abs(x.second)%2!=0)
          {
            le++;
          }
           else if(x.second>0&&abs(x.second)%2!=0)
          {
             ri++;
          }
       }
       int p=min(le,ri);
       ans+=p;
       left-=p;
       right-=p;
       le-=p;
       ri-=p;
      // cout<<ans<<" "<<left<<" "<<right<<" "<<le<<" "<<ri<<"\n";
       if(ri==0)
       {
           int d=min(le,right);
           ans+=d;
           left-=d;
          right-=d;
          le-=d;
          ans+=le;
          left-=le;
          ans+=(left+right)/2;

       }
       else{
           int e=min(ri,left);
            ans+=e;
          left-=e;
          right-=e;
          ri-=e;
          ans+=ri;
          right-=ri;
          ans+=(left+right)/2;
       }
        cout<<ans<<"\n";
    }
    }