#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <cassert>
#include <algorithm>
#include <bitset>
 
using namespace std;
 
#define ll long long
#define dbl double

const int M = 1e5 + 7;
 
void trueMain() {
    ll n, L, R;
    cin >> n >> L >> R;
    multiset<int> l, r;
    for (int i = 0; i < L; i++){
        int x;
        cin >> x;
        l.insert(x);
    }
    for (int i = 0; i < R; i++){
        int x;
        cin >> x;
        r.insert(x);
    }
    
    multiset<int> new_l;
    for (int x : l){
        auto f = r.find(x);
        if (f != r.end())
            r.erase(f);
        else
            new_l.insert(x);
    }
    swap(l, new_l);
    if (l.size() < r.size())
        swap(l, r);

    // cout << l.size() << ' ' << r.size() << endl;
    map<int, int> cnt;
    for (int x : l)
        cnt[x]++;
    int d = (l.size() - r.size()) / 2;
    int ok = 0;
    for (auto[k, v] : cnt)
        ok += v / 2;
    int f = min(ok, d);
    int res = f;
    d -= f;
    res += d;
    res += (l.size() + r.size()) / 2 - f;
    cout << res << endl;
}
 
 
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t = 1;
    cin >> t;
    for (int i = 0; i < t; i++)
        trueMain();
}