#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define CASE int Kase = 0; cin >> Kase; for(int kase = 1; kase <= Kase; kase++)
using namespace std;
template<typename T = long long> inline T read() {
    T s = 0, f = 1; char ch = getchar();
    while(!isdigit(ch)) {if(ch == '-') f = -1; ch = getchar();}
    while(isdigit(ch)) {s = (s << 3) + (s << 1) + ch - 48; ch = getchar();} 
    return s * f;
}
#ifdef ONLINE_JUDGE
#define qaq(...) ;
#define qwq(c) ;
#else
#define qwq(a, b) for_each(a, b, [=](int x){cerr << x << " ";}), cerr << std::endl
template <typename... T> void qaq(const T &...args) {
    auto &os = std::cerr;
    (void)(int[]){(os << args << " ", 0)...};
    os << std::endl;
}
#endif
const int N = 4e5 + 5, M = 1e6 + 5, MOD = 1e9 + 7, CM = 998244353, INF = 0x3f3f3f3f; const ll linf = 0x7f7f7f7f7f7f7f7f;
/*
1元钱进行变换袜子颜色
1元钱进行左右袜子变化
*/
int le[N], ri[N];
int cal1(std::map<int, int> mp){
    std::vector<int> lef, rig;
    int ans = 0;
    for(auto x : mp) {
        if(x.second > 0) {
            int num = x.second;
            ans += num / 2;
            if(num & 1) lef.push_back(x.first);
        } else {
            int num = -x.second;
            ans += num / 2;
            if(num & 1) rig.push_back(x.first);
        }
    }
    int siz_le = lef.size(), siz_ri = rig.size();
    int mi = min(siz_le, siz_ri);
    ans += mi;
    siz_le -= mi, siz_ri -= mi;
    ans += siz_le + siz_ri;
    return ans;
}
struct Node{
    int col, times;
    bool operator < (const Node &b) const {
        return (times & 1) < (b.times & 1);
    }
};
int cal2(std::map<int, int> mp){
    priority_queue<Node> lef, rig;
    int ans = 0;
    for(auto x : mp) {
        if(x.second > 0) {
            lef.push({x.first, x.second});
        }else {
            rig.push({x.first, -x.second});
        }
    }
    while(!lef.empty() && !rig.empty()){
        Node nowlef = lef.top(); lef.pop();
        Node nowrig = rig.top(); rig.pop();
        nowlef.times--;
        nowrig.times--;
        ans++;
        if(nowlef.times) lef.push(nowlef);
        if(nowrig.times) rig.push(nowrig);
    }
    int anther = 0;
    while(!lef.empty()){
        Node now = lef.top(); lef.pop();
        ans += now.times / 2;
        if(now.times & 1) anther++;
    }
    while(!rig.empty()) {
        Node now = rig.top(); rig.pop();
        ans += now.times / 2;
        if(now.times & 1) anther++;
    }
    return ans + anther;
}
void solve(int kase){
    int n = read(), l = read(), r = read();
    std::map<int, int> mp;
    for(int i = 1; i <= l; i++) {
        le[i] = read();
        mp[le[i]]++;
    }
    for(int i = 1; i <= r; i++) {
        ri[i] = read(); mp[ri[i]]--;
        if(mp[ri[i]] == 0) mp.erase(ri[i]);
    }
    int ans = min(cal1(mp), cal2(mp));
    printf("%d\n", ans);
}
const bool ISFILE = 0, DUO = 1;
int main(){
    clock_t start, finish; double totaltime; start = clock();
    if(ISFILE) freopen("/Users/i/Desktop/practice/in.txt", "r", stdin);
    if(DUO) {CASE solve(kase);} else solve(1);
    finish = clock(); 
    qaq("\nTime:", (double)(finish - start) / CLOCKS_PER_SEC * 1000, "ms\n");
    return 0;
}