#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-13;
const long double PI = acos(-1);
const int INF = (int)1e9;
const long long INFF = (long long)1e18;
const int mod = (int)1e9 + 7;
const int MXN = (int)3e5 + 7;
char s[MXN];
long long cnt[26];
int dp[MXN];
int main(void) {
  int t;
  scanf("%d", &t);
  dp[0] = 1;
  while (t--) {
    int n, m, l;
    scanf("%d %d %d %s", &n, &m, &l, s + 1);
    for (int i = 0; i < 26; i++) cnt[i] = 0;
    for (int i = 1; i < l + 1; i++) cnt[s[i] - 'A']++;
    for (int i = 1; i < l + 1; i++) dp[i] = 0;
    for (int i = 0; i < 26; i++) {
      for (int j = l - cnt[i]; j >= 0; j--) {
        if (dp[j]) dp[j + cnt[i]] = 1;
      }
    }
    bool op = 0;
    for (int i = n; i < l + 1; i++)
      if (dp[i]) {
        if (l - i >= m) op = 1;
        break;
      }
    if (op) {
      puts("0");
      continue;
    }
    long long ans = INFF;
    for (int i = 0; i < 26; i++)
      if (cnt[i]) {
        for (int j = 1; j < n + 1; j++) dp[j] = 0;
        for (int j = 0; j < 26; j++)
          if (i != j) {
            for (int k = n - cnt[j]; k >= 0; k--)
              if (dp[k]) {
                dp[k + cnt[j]] = 1;
              }
          }
        for (int j = n - cnt[i] + 1; j < n; j++)
          if (j >= 0 && dp[j]) {
            long long v1 = n - j;
            long long v2 = cnt[i] - v1;
            long long la = l - j - cnt[i];
            v2 = min(v2, m - la);
            ans = min(ans, v1 * v2);
          }
      }
    printf("%lld\n", ans);
  }
  return 0;
}
