#include<bits/stdc++.h>

// clock_t start = clock();
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define LL long long
using namespace std;


int go = chrono::steady_clock::now().time_since_epoch().count();
mt19937 rng(go);
#define rand(l, r) uniform_int_distribution<LL>(l, r)(rng)

const int N = (int)1e6;
int col[N], lcol[N], rcol[N];

void solve() {
    int n, l, r, ans = 0;
    cin >> n >> l >> r;
    for (int i=1;i<=n;++i) col[i] = lcol[i] = rcol[i] = 0;
    for (int i=0;i<n;++i) {
        cin >> col[i];
        if (i < l) lcol[col[i]]++;
        else rcol[col[i]]++;
    }
    multiset<int> lc_eve, lc_odd;
    int lsum = 0, rsum = 0;
    for (int i=1;i<=n;++i) {
        int sub = min(lcol[i], rcol[i]);
        lcol[i] -= sub;
        rcol[i] -= sub;
        lsum += lcol[i];
        rsum += rcol[i];
    }
    if (lsum < rsum) {
        for (int i=1;i<=n;++i) {
            swap(lcol[i], rcol[i]);
        }
        swap(lsum, rsum);
    }
    for (int i=1;i<=n;++i) if (lcol[i] > 0) {
        if (lcol[i] & 1) {
            lc_odd.insert(lcol[i]);
        } else {
            lc_eve.insert(lcol[i]);
        }
    }

    // for (int x : lc_odd) cout << x << " "; cout << '\n';
    // for (int x : lc_eve) cout << x << " "; cout << '\n';

    for (int i=0;i<rsum;++i) {
        if (lc_odd.empty()) {
            auto it = lc_eve.begin();
            int go = *it;
            lc_eve.erase(it);
            lc_odd.insert(go-1);
        } else {
            auto it = lc_odd.begin();
            int go = *it;
            if (go > 1) lc_eve.insert(go-1);
            lc_odd.erase(it);
        }
        ++ans;
    }
    // cout << ans << " here\n";
    for (int x : lc_odd) {
        ans += x/2 + 1;
    }
    for (int x : lc_eve) {
        ans += x/2;
    }
    cout << ans << '\n';
}

int main() {
    FASTIO;
    int T = 100;
    cin >> T;
    for (int t=1;t<=T;++t) {
        solve();
    }
    // cerr << (clock() - start) / ((double) CLOCKS_PER_SEC) << '\n';
    return 0;
}