#include <bits/stdc++.h>
template<typename T, typename U>
std::ostream& operator<<(std::ostream& os, std::pair<T, U> v) {
    return os << '(' << v.first << ", " << v.second << ')';
}
template<typename T>
std::ostream& operator<<(std::ostream& os, std::set<T> s) {
    if (s.empty())
        return os << "{}";
    os << '{';
    for (auto it = s.begin(); it != prev(s.end()); it++) {
        os << *it << ", ";
    }
    return os << *(prev(s.end())) << '}';
}
template<typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> v) {
    if (v.empty())
        return os << "[]";
    os << '[';
    for (int i = 0; i < v.size() - 1; i++) {
        os << v[i] << ", ";
    }
    return os << v.back() << ']';
}
void Solve() {
    int n, l, r;
    std::cin >> n >> l >> r;
    std::vector<int> lc(n), rc(n);
    for (int i = 0; i < l; i++) {
        int x;
        std::cin >> x;
        lc[x - 1]++;
    }
    for (int i = 0; i < r; i++) {
        int x;
        std::cin >> x;
        rc[x - 1]++;
    }
    for (int i = 0; i < n; i++) {
        int t = std::min(lc[i], rc[i]);
        lc[i] -= t;
        rc[i] -= t;
    }
    int lo = 0, ro = 0;
    for (int i = 0; i < n; i++) {
        if (lc[i] % 2 == 1)
            lo++;
        if (rc[i] % 2 == 1)
            ro++;
    }
    int sl = std::accumulate(lc.begin(), lc.end(), 0);
    int sr = std::accumulate(rc.begin(), rc.end(), 0);
    if (sl <= sr) {
        ro = std::max(0, ro - sl);
        std::cout << (sl + sr + ro) / 2 << '\n';
    } else {
        lo = std::max(0, lo - sr);
        std::cout << (sl + sr + lo) / 2 << '\n';
    }
}
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int t;
    std::cin >> t;
    while (t--) {
        Solve();
    }
}