//
//  main.cpp
//  cfr14D
//
//  Created by Kevin Paul on 07/05/21.
//

#include <bits/stdc++.h>
using namespace std;
int n, l, r;
int arr[200001], fl[200001], fr[200001];
int main(int argc, const char * argv[]) {
    int t;
    cin>>t;
    while(t--){
        
        cin>>n>>l>>r;
        
        for(int i = 0;i<n+1;i++){
            fl[i] = 0;
            fr[i] = 0;
        }
        for(int i = 0;i<n;i++){
            cin>>arr[i];
            if(i<l){
                fl[arr[i]]++;
            }
            else{
                fr[arr[i]]++;
            }
        }
        
        for(int i = 1;i<=n;i++){
            int matched = min(fl[i], fr[i]);
            fl[i]-=matched;
            fr[i]-=matched;
            l-=matched;
            r-=matched;
        }
        if(r>l){
            swap(l,r);
            swap(fl, fr);
        }
        int ans = 0;
        for(int i = 1;i<=n;i++){
            int req = l-r;
            int pos = fl[i]/2;
            int todo = min(req, pos*2);
            l-=todo;
            ans+=todo/2;
        }
        ans+=(l-r)/2 + (l+r)/2;
        cout<<ans<<"\n";
        
    }
    return 0;
}
