#include <bits/stdc++.h>
using namespace std;
long long n, m, k;
string s;
long long f[26];
bool check() {
  vector<long long> dp(k + 1, 0);
  dp[0] = 1;
  for (long long j = 0; j < 26; j++) {
    for (long long w = k; w >= 0; w--) {
      if (dp[w]) dp[w + f[j]] = 1;
    }
  }
  for (long long i = 0; i < k + 1; i++) {
    if (dp[i] and i >= m and (long long) s.size() - i >= n) return 1;
  }
  return 0;
}
void solve() {
  long long ans = 1000000007;
  cin >> n >> m >> k;
  cin >> s;
  memset(f, 0, sizeof f);
  for (auto i : s) {
    f[i - 'A']++;
  }
  if (check()) {
    cout << 0 << '\n';
    return;
  }
  for (long long i = 0; i < 26; i++) {
    vector<long long> dp(k + 1, 0);
    dp[0] = 1;
    for (long long j = 0; j < 26; j++) {
      if (i == j) continue;
      for (long long w = k; w >= 0; w--) {
        if (dp[w]) dp[w + f[j]] = 1;
      }
    }
    for (long long j = 0; j < k + 1; j++) {
      if (dp[j]) {
        long long N = min(n, j), M = min(m, (long long)s.size() - j - f[i]);
        if (N < 0 or M < 0) continue;
        if (N + M + f[i] >= n + m) {
          long long first = n - N, second = m - M;
          ans = min(ans, first * second);
        }
      }
    }
  }
  cout << ans << '\n';
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
