#include <iostream>
using namespace std;
int main()
{
    long long tc;
    cin >> tc;
    while (tc--)
    {
        long long n,l,r,ans=0,anss=0, a[200005], b[200005], j, i,t,d,k;
        cin >> n >> l >> r;
        for(i=0;i<=n;i++)a[i]=0,b[i]=0;
        for (i = 0; i < l; i++)
        {
            cin >> d;
            a[d]++;
        }
        for (i = 0; i < r; i++)
        {
            cin >> d;
            b[d]++;
        }
        for (i = 1; i <= n; i++)
        {
            
            if (a[i] && b[i])
            {
                ans += min(a[i], b[i]);
                int kk=min(a[i],b[i]);
                
                a[i] -= kk;
                b[i] -= kk;
                
            }
        }
        if (l < r)
        {
            t = (n / 2) - l;
            for (i = 1; i <= n; i++)
            {
                while (b[i] > 1 && t > 0)
                {
                    b[i] -= 2;
                    t--;
                    ans++;
                    anss++;
                }
            }
            if (t > 0)
            {
                for (i = 1; i <= n; i++)
                {
                    while (b[i] > 0 && a[i] > 0 && t > 0)
                    {
                        b[i]--;
                        a[i]--;
                        t--;
                        ans++;
                        anss++;
                    }
                }
            }
            if (t > 0)
            {
                ans += t;
                anss += (2 * t);
            }
        }
        else if (l > r)
        {
            t = (n / 2) - r;
            for (i = 1; i <= n; i++)
            {
                while (a[i] > 1 && t > 0)
                {
                    a[i] -= 2;
                    t--;
                    ans++;
                    anss++;
                }
            }
            if (t > 0)
            {
                for (i = 1; i <= n; i++)
                {
                    while (b[i] > 0 && a[i] > 0 && t > 0)
                    {
                        b[i]--;
                        a[i]--;
                        t--;
                        ans++;
                        anss++;
                    }
                }
            }
            if (t > 0)
            {
                anss += (2 * t);
                ans += t;
            }
        }
        //cout<<ans<<endl;
        cout << (n / 2) - ans + anss << endl;
    }
}
