#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <deque>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <random>

using namespace std;

void solve() {
    int n, l, r;
    cin>>n>>l>>r;
    vector < int > left(n), right(n);

    for (int i = 0; i < l; i++) {
        int c;
        cin>>c;
        c--;
        left[c]++;
    }

    for (int i = 0; i < r; i++) {
        int c;
        cin>>c;
        c--;
        right[c]++;
    }

    int res = 0;
    for (int i = 0; i < n; i++) {
        while (left[i] > 0 && right[i] > 0) {
            left[i]--;
            right[i]--;
            r--;
            l--;
        }
    }

    for (int i = 0; i < left.size() && l > r; i++) {
        while (left[i] >= 2 && l > r) {
            left[i] -= 2;
            res += 1;
            l -= 2;
        }
    }

    for (int i = 0; i < right.size() && r > l; i++) {
        while (right[i] >= 2 && r > l) {
            right[i] -= 2;
            res += 1;
            r -= 2;
        }
    }

    int cnt = 0;
    for (auto i : left) {
        cnt += i;
    }
    for (auto i : right) {
        cnt += i;
    }
    cout<<(res + cnt / 2 + abs(r - l) / 2)<<"\n";

}

int main() {
    ios::sync_with_stdio(false);
    int t;
    cin >> t;
    while (t--)
        solve();
}