#include  <bits/stdc++.h>
using namespace std;
using str = string; // yay python!

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector <ll> vl;

#define FOR(i, a, b) for (int i=a; i<b; i++)
#define F0R(i, a) for (int i=0; i<a; i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define vt vector
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define sz(x) (int)size(x)
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

string to_string(char c) {
  return string(1, c);
}
string to_string(bool b) {
  return b?"true":"false";
}
string to_string(const char* s) {
	return string(s);
}
string to_string(string s) {
	return s;
}
template<class A> void write(A x) {
	cout << to_string(x);
}
template<class H, class... T> void write(const H& h, const T&... t) { 
	write(h);
	write(t...);
}
void print() {
	write("\n");
}
template<class H, class... T> void print(const H& h, const T&... t) { 
	write(h);
	if(sizeof...(t))
		write(' ');
	print(t...);}

const int d4i[4]={-1, 0, 1, 0}, d4j[4]={0, 1, 0, -1};
const int d8i[8]={-1, -1, 0, 1, 1, 1, 0, -1}, d8j[8]={0, 1, 1, 1, 0, -1, -1, -1};

const int mod=1000000007;
//-------------------####Real Programming###------------------

/*Problem C - Berland Regional
int N,u[200050],s[200050];
ll ans[200050]; vl us[200050];
void solve(){
  cin>>N;
  F0R(i,N){cin>>u[i];}
  F0R(i,N){cin>>s[i];us[u[i]].push_back(s[i]);}//2d
  FOR(i,1,N+1){
    sort(us[i].begin(),us[i].end(),greater<int>());
    FOR(j,1,us[i].size()){
      us[i][j]+=us[i][j-1];
    }
    FOR(j,1,us[i].size()+1){
      ans[j]+=us[i][us[i].size()/j*j-1];
    }
  }
  FOR(i,1,N) {
		cout<<ans[i]<<' '; us[i]=vector<ll>(),ans[i]=0;
	}
  cout<<"\n";
}*/
int N,L,R;
int C[200001];
int lcnt[200001],rcnt[200001];
void solve(){
  cin>>N>>L>>R;
  for (int i=1;i<=N;i++){
    lcnt[i]=0;
    rcnt[i]=0;
  }for (int i=1;i<=N;i++){
    cin>>C[i];
    if (i<=L)
      lcnt[C[i]]++;
    else
      rcnt[C[i]]++;
  }
  
  for (int i=1;i<=N;i++){
    int mn=min(lcnt[i],rcnt[i]);
    lcnt[i]-=mn;
    rcnt[i]-=mn;
    L-=mn;
    R-=mn;
  }
  if (L<R){
    swap(lcnt,rcnt);
    swap(L,R);
  }
  int ans=0;
  for (int i=1;i<=N;i++){
    int extra=L-R; //always even
    int canDo=lcnt[i]/2;
    int Do=min(canDo*2,extra);
    //turn "Do"/2 left socks of color i into right socks
    ans+=Do/2;
    L-=Do;
  }
  //turn extra lefts into rights, then adjust all colors
  ans+=(L-R)/2+(L+R)/2;
  cout<<ans<<endl;
}

int main() {
  //freopen("test.in", "r", stdin);
  //freopen("test.out", "w", stdout); 
  ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
  int T;cin>>T;
  while(T--){
    solve();
  }
	return 0;
}