/********************************************************************
*                                                                   *
*                                                                   *
*                         Coded By colin!                           *
*                                                                   *
*                                                                   *
********************************************************************/

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(0)
typedef long long ll;
using namespace std;
int N,L,R;
int C[200001];
int lcnt[200001],rcnt[200001];

ll gcd(ll a, ll b){
    if(b==0)return a;
    else return gcd(b,a%b);
}

ll lcm(ll a, ll b){
    return a*b/gcd(a,b);
}

ll nCr(ll n, ll r){ 
    if(n==r||r==0)
    {
        return 1;
    }
    return nCr(n-1,r-1)+nCr(n-1,r);
}

ll nPr(ll n, ll r){ 
    ll i,per=1;
    for(i=n; i>=n-r+1; i--)
    {
        per*=i;
    }
    return per;
}

ll catalan(ll n){
    return nCr(2*n,n) / (n+1);
}   



void solve(){
  cin>>N>>L>>R;
  for(int i=1;i<=N;i++){lcnt[i]=0; rcnt[i]=0;}
  for(int i=1;i<=N;i++){
    cin>>C[i];
    if (i<=L) lcnt[C[i]]++;
    else rcnt[C[i]]++;
  }
  for(int i=1;i<=N;i++){
    int mn=min(lcnt[i],rcnt[i]);
    lcnt[i]-=mn;rcnt[i]-=mn;L-=mn;R-=mn;
  }
  if(L<R){
    swap(lcnt,rcnt);
    swap(L,R);
  }
  int ans=0;
  for (int i=1;i<=N;i++){
    int extra=L-R, canDo=lcnt[i]/2, Do=min(canDo*2,extra);
    ans+=Do/2;
    L-=Do;
  }
  ans+=(L-R)/2+(L+R)/2;
  cout<<ans<<endl;
}


int main()
{
	ll t;
	cin>>t;
	while(t--)
	{
		solve();
	}
}