#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define imax 0x3f3f3f3f
#define lmax 0x3f3f3f3f3f3f3f3f
ll gcd(ll a, ll b)
{
    return b ? gcd(b, a % b) : a;
}
ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}
bool isprime(ll num)
{
    if (num == 1)
        return 0;
    if (num == 2 || num == 3)
        return 1;
    if (num % 6 != 1 && num % 6 != 5)
        return 0;
    int tmp = sqrt(num);
    for (ll i = 5; i <= tmp; i += 6)
        if (num % i == 0 || num % (i + 2) == 0)
            return 0;
    return 1;
}
long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1) res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
struct node{
    int top;
    int bottom;
    int num;
    bool operator < (node a){
        if(top!=a.top)
            return top < a.top;
        return num < a.num;
    }

};

struct point{
    double x,y;
    point(double x=0,double y=0):x(x),y(y) {}
    point operator + (const point a){
        return point(x+a.x,y+a.y);
    }
    point operator - (const point a){
        return point(x-a.x,y-a.y);
    }
};


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int _,ii=0;
    cin>>_;
    while(_--){
        int n,l,r,s;
        cin>>n>>l>>r;
        map<int,int> ls;
        map<int,int> rs;
        for (int i = 0; i < n; ++i) {
            cin>>s;
            if(i<l){
                ls[s]++;
            }
            else {
                rs[s]++;
            }
        }
        int re=abs(l-r)/2;
        int ne=re;

        if(l>r){
            for(auto i:ls){
                int swa=i.second-rs[i.first];
                if(swa>=2){
                    if(swa/2<ne){
                        ne-=swa/2;
                        rs[i.first]+=swa/2;
                        ls[i.first]-=swa/2;
                    }
                    else{
                        rs[i.first]+=ne;
                        ls[i.first]-=ne;
                        ne=0;
                        break;
                    }

                }

            }
            if(ne!=0)
            for(auto i:ls){
                if(i.second-rs[i.first]>=1){
                    if(ne>1){
                        ne--;
                        rs[i.first]++;
                        ls[i.first]--;
                    }
                    else{
                        rs[i.first]+=ne;
                        ls[i.first]-=ne;
                        ne=0;
                        break;
                    }

                }
            }

        }
        else if(l<r){

            for(auto i:rs){
                int swa=i.second-ls[i.first];
                if(swa>=2){
                    if(swa/2<ne){
                        ne-=swa/2;
                        ls[i.first]+=swa/2;
                        rs[i.first]-=swa/2;
                    }
                    else{
                        ls[i.first]+=ne;
                        rs[i.first]-=ne;
                        ne=0;
                        break;
                    }
                }
            }
//            for(auto i:ls) cout<<i.second<<" ";
//            cout<<endl;
//            for(auto i:rs) cout<<i.second<<" ";
//            cout<<endl;
            if(ne!=0) {
                for (auto i:rs) {
                    if (i.second - ls[i.first] >= 1) {
                        if (ne > 1) {
                            ne--;
                            ls[i.first]++;
                            rs[i.first]--;
                        } else {
                            ls[i.first] += ne;
                            rs[i.first] -= ne;
                            break;
                        }

                    }
                }
            }
        }
        ne=0;

        for (int i = 1; i <= n; ++i) {
            if(ls[i]!=rs[i]){
                if(ls[i]-rs[i]>0){
                    if(ne>0) {
                        re+=ls[i]-rs[i];
                        ne+=ls[i]-rs[i];
                    }
                    else{
                        ne+=ls[i]-rs[i];
                        if(ne>0)re+=ne;
                    }
                }
                else if(ls[i]-rs[i]<0){
                    if(ne<0){
                        re+=abs(ls[i]-rs[i]);;
                        ne+=ls[i]-rs[i];
                    }
                    else{
                        ne+=ls[i]-rs[i];
                        if(ne<0) re+=abs(ne);
                    }
                }
            }
        }
        ii++;
        cout<<re<<endl;




    }




}