#include <bits/stdc++.h>
using namespace std;
typedef long double LD; 
typedef long long ll; 
#define int ll 
#define ff(i,a,b) for (int i = a; i < b; i++) 
#define bf(i,a,b) for (int i = a; i >= b; i--) 
#define all(v) v.begin(),v.end() 
#define show(a) for(auto xyz:a)cout<<xyz<<" ";cout<<endl;
#define F first 
#define S second
#define pb push_back
#define mp make_pair
#define lb lower_bound   
#define ub upper_bound
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define one cout<<"-1"<<endl
#define pi 3.141592653589793238
#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl
#define intmx INT_MAX 
#define intmi INT_MIN
const int MOD=1e9+7;

void solve(){
   int n,l,r;
   cin>>n>>l>>r;
   map<int,int> left,right;
   ff(i,0,n){
       int x;
       cin>>x;
       if(i<=l-1)
       left[x]++;
       else
       right[x]++;
   }
   for(auto &i:left){
       int x=min(i.S,right[i.F]);
       i.S-=x;
       right[i.F]-=x;
       //cout<<i.F<<" "<<i.S<<endl;
   }
   int cntl=0,cntr=0;
   for(auto i:left)
   cntl+=i.S;
   for(auto i:right)
   cntr+=i.S;
   int ans=0;
   if(cntl<=cntr){
       ans+=cntl;
       int d=(cntr-cntl)/2;
       int cnt=0;
       for(auto i:right){
           cnt+=i.S/2;
       }
       if(cnt<d){
           ans+=cnt;
           ans+=2*(d-cnt);
       }
       else
       ans+=d;
   }
   else{
       ans+=cntr;
       int d=(cntl-cntr)/2;
       int cnt=0;
       for(auto i:left){
           cnt+=i.S/2;
       }
       if(cnt<d){
           ans+=cnt;
           ans+=2*(d-cnt);
       }
       else
       ans+=d;
   }
   cout<<ans<<endl;
}
signed main() {
    int t=1;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>t;
    while(t--){
        solve();
    }
}
