#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template <class T>
inline bool ckmin(T& a, T b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
inline bool ckmax(T& a, T b) {
  return b > a ? a = b, 1 : 0;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const char nl = '\n';
const int mxN = 2e5 + 10;
const int MOD = 1e9 + 7;
const long long infLL = 1e18;
void solve() {
  vi cnt(26);
  int n, m, k;
  string second;
  cin >> n >> m >> k >> second;
  for (auto& S : second) cnt[S - 'A']++;
  ll ans = infLL;
  for (int cur = (0); cur < (26); cur++) {
    vi seen(k + 1, 0);
    seen[0] = 1;
    for (int i = (0); i < (26); i++) {
      if (i == cur) continue;
      for (int j = (k + 1 - 1); j >= (0); j--) {
        if (j - cnt[i] >= 0) seen[j] |= seen[j - cnt[i]];
      }
    }
    const int dif = k - n - m;
    for (int i = n; i >= 0 && i + cnt[cur] >= n; i--) {
      if (!seen[i]) continue;
      int amtA = n - i;
      int amtB = max(0, cnt[cur] - amtA - dif);
      ckmin(ans, 1LL * amtA * amtB);
    }
  }
  cout << ans << nl;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
