#include <bits/stdc++.h>
using namespace std;
long long int t, n, m, k;
string s;
long long int dp[30][30004];
long long int frq[30];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long int i, j, x;
  cin >> t;
  while (t--) {
    cin >> n >> m >> k;
    cin >> s;
    long long int ans = 1e10;
    long long int tot = s.size();
    memset(frq, 0, sizeof frq);
    for (i = 0; i < s.size(); i++) {
      frq[s[i] - 'A' + 1]++;
    }
    for (i = 1; i <= 26; i++) {
      for (j = 0; j <= 27; j++) {
        for (k = 0; k <= n; k++) {
          dp[j][k] = 0;
          if (k == 0) dp[j][k] = 1;
        }
      }
      for (j = 1; j <= 26; j++) {
        for (k = 1; k <= n; k++) {
          dp[j][k] = dp[j - 1][k];
          if (i != j && k - frq[j] >= 0 && dp[j - 1][k - frq[j]] == 1) {
            dp[j][k] = 1;
          }
        }
      }
      long long int rem = tot - frq[i];
      for (k = 0; k <= n; k++) {
        if (dp[26][k]) {
          long long int cn = n - k;
          long long int cm = m - rem + k;
          if (cm <= 0) {
            if (frq[i] >= cn) ans = min(ans, 0LL);
          } else {
            if (cn == 0) {
              if (frq[i] >= cm) ans = min(ans, 0LL);
            } else {
              if (frq[i] >= cn + cm) {
                ans = min(ans, cn * cm);
              }
            }
          }
        }
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
