// I have loved the stars to fondly to be fearful of the night !
// Illusion are mere observation which sometimes skips through mind !
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,j,k) for(int i=j;i<k;i+=1)
#define sorti(v) sort(v.begin(),v.end())
#define sortd(v) sort(v.begin(),v.end(),greater<int>())
#define mm map<int,int>
#define vv vector<int>
#define tmm map<int,map<int,int>>
#define trav(a, x) for(auto& a : x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define pb push_back
#define alot(x,y) memset(x,y,sizeof(x))
#define pii pair<int,int>
#define TakeItEasy ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const int MOD=1e9+7;
const int N=2e5+5;
const double pi=acos(-1.0);
int addM(int a,int b){
    return (a+b)%MOD;
}
int multM(int a,int b){
    return (a*b)%MOD;
}
int binpow(int a,int b){
    int res=1;
    while(b>0){
        if(b&1)res*=a;
        a*=a;
        b>>=1;

    }
    return res;
}
int ModInverse(int n){
    return binpow(n,MOD-2);
}
vector<int> findFact(){
    vv fact(N);
    fact[0]=1;
    for(int i=1;i<=N;i++){
        fact[i]=multM(i,fact[i-1]);
    }
    return fact;
}
int ncr(int n,int r){
    vv fact=findFact();
    return ((fact[n]*ModInverse(fact[n-r]))%MOD*ModInverse(fact[r]))%MOD;
}
vector<bool> findPrime(){
vector<bool>is_prime(N+1,true);
    is_prime[0]=false;
    is_prime[1]=false;
for (int i = 2; i <=N; i++) {
    if (is_prime[i] && i * i <= N) {
        for (int j = i * i; j <= N; j += i)
            is_prime[j] = false;
    }
}
return is_prime;
}
vector<bool> segmentedSieveNoPreGen(long long L, long long R) {
    vector<bool> isPrime(R - L + 1, true);
    long long lim = sqrt(R);
    for (long long i = 2; i <= lim; ++i)
        for (long long j = max(i * i, (L + i - 1) / i * i); j <= R; j += i)
            isPrime[j - L] = false;
    if (L == 1)
        isPrime[0] = false;
    return isPrime;
}
//-------------------------------------------------------------------------------------------------------------------------
int32_t main ()
{
    TakeItEasy;
    int tt;
    cin>>tt;
    //tt=1;
    while(tt--){
    	int n,l,r;
    	cin>>n>>l>>r;
    	mm left;
    	mm right;
    	set<int> lf;
    	set<int> rt;
    	for(int i=0;i<n;i++){
    		int p;
    		cin>>p;
    		if(i<l){
    			left[p]++;
    			lf.insert(p);
    		}
    		else{
    			right[p]++;
    			rt.insert(p);
    		}
    	}
    	trav(x,lf){
    		while(right[x]>0 && left[x]>0){
    			right[x]--;
    			left[x]--;
    		}
    	}
    	set<int> nlf;
    	set<int> nrt;
    	trav(x,lf){
    		if(left[x]>0){
    			nlf.insert(x);
    		}
    	}
    	trav(x,rt){
    		if(right[x]>0){
    			nrt.insert(x);
    		}
    	}
    	lf.clear();
    	rt.clear();
    	trav(x,nlf){
    		lf.insert(x);
    	}
    	trav(x,nrt){
    		rt.insert(x);
    	}
    	int ans=0;
    	int cntlf=0;
    	int cntrt=0;
    	trav(x,lf){
    		cntlf+=left[x];
    	}
    	trav(x,rt){
    		cntrt+=right[x];
    	}
    	if(cntlf>cntrt){
    		int tot=(cntlf+cntrt)/2;
    		int cnt=cntlf-tot;
    		trav(x,lf){
    			while(left[x]>1 && cnt>0){
    				cnt--;
    				ans++;
    				left[x]-=2;
    			}
    			if(cnt==0){
    				break;
    			}
    		}
    		trav(x,lf){
    			while(left[x]>0 && cnt>0){
    				cnt--;
    				ans++;
    				left[x]-=1;
    			}
    			if(cnt==0){
    				break;
    			}
    		}
    	    int g=0;
    	    trav(x,lf){
    	    	g+=left[x];
    	    }
    	    ans+=g;
    	    cout<<ans<<"\n";
    		
    	}
    	else if(cntrt>cntlf){
    		int tot=(cntlf+cntrt)/2;
    		int cnt=cntrt-tot;
    		trav(x,rt){
    			while(right[x]>1 && cnt>0){
    				cnt--;
    				ans++;
    				right[x]-=2;
    			}
    			if(cnt==0){
    				break;
    			}
    		}
    		//cout<<cnt<<" "<<right[1]<<'\n';
    		trav(x,rt){
    			while(right[x]>0 && cnt>0){
    				cnt--;
    				ans++;
    				right[x]-=1;
    			}
    			if(cnt==0){
    				break;
    			}
    		}
    	    int g=0;
    	    trav(x,rt){
    	    	g+=right[x];
    	    }
    	    ans+=g;
    	    cout<<ans<<"\n";
    		
    	}
    	else{
    		ans+=cntrt;
    		cout<<ans<<'\n';
    	}
    	









    }
    return 0;
}
/*
memset(array_name,value_to_be_intialized,sizeof(array_name));
 __builtin_popcount(n) count no of set bit in number n
next_permutation(s.begin(),s.end());
// lower_bound==> if the element is present it return its first occurence else 1st element which is greater than
// upper_bound==> it will always return iterator to element which is greater than searched element
(prno->n-3n/2) atleast one prime
*/
