#include "bits/stdc++.h"
#include <algorithm>
#include <cstddef>
#include <fstream>
#include <string>
#include <iostream>
using namespace std;
int main() {
// string path;
// cin >> path;
// auto f = ifstream(path);
int T;
cin >> T;
for (int i = 0; i < T; i++) {
int N, csikke, boci, V, C, B;
V = C = B = 0;
cin >> N >> csikke >> boci;
for (int k = 0; k < N; k++) {
char c;
cin >> c;
if (c == 'C')
C++;
else if (c == 'B')
B++;
else if (c == 'V')
V++;
}
int vegyes_max = min({csikke, boci, V});
int csirke_max = min(csikke/2, C);
int boci_max = min(boci/2, B);
bool f = false;
int l = -69420;
int i2 = 0;
for (int j = 0; j <= vegyes_max; ++j) {
int val = j + min((csikke-j)/2, C) + min((boci-j)/2, B);
l = max(val, l);
i2 = j;
}
// cout << "DEBUG: " << i2 << ' ' << vegyes_max << ' ' << C << ' ' << B << ' ' <<
// i2 + min((csikke-i2)/2, C) + min((boci-i2)/2, B) << ' ' << vegyes_max + min((csikke-vegyes_max)/2, C) + min((boci-vegyes_max)/2, B) << "\n";
cout << l << "\n";
// cout << max(
// i2 + min((csikke-i2)/2, C) + min((boci-i2)/2, B),
// vegyes_max + min((csikke-vegyes_max)/2, C) + min((boci-vegyes_max)/2, B)
// );
// cout << "\n";
}
}