#include <bits/stdc++.h>
using namespace std;
int freq[30];
bool dp[30][200005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  for (int i = (1); i <= (t); i += (1)) {
    int n, m, s;
    cin >> n >> m >> s;
    string S;
    cin >> S;
    memset(freq, 0, sizeof(freq));
    for (int i = (0); i <= (s - 1); i += (1)) {
      freq[S[i] - 'A' + 1]++;
    }
    long long ans = 1000000000000000000;
    for (int i = (1); i <= (26); i += (1)) {
      if (!freq[i]) continue;
      int f = freq[i];
      freq[i] = 0;
      for (int j = (0); j <= (26); j += (1))
        for (int k = (0); k <= (n); k += (1)) dp[j][k] = 0;
      dp[0][0] = true;
      for (int j = (1); j <= (26); j += (1)) {
        for (int k = (0); k <= (n); k += (1)) {
          dp[j][k] |= dp[j - 1][k];
          if (k >= freq[j]) {
            dp[j][k] |= dp[j - 1][k - freq[j]];
          }
          if (j == 26 && dp[j][k]) {
            if (k + f >= n) {
              ans = min(ans, 1LL * (n - k) * min(k + f - n, m - (s - f - k)));
            }
          }
        }
      }
      for (int j = (0); j <= (26); j += (1))
        for (int k = (0); k <= (m); k += (1)) dp[j][k] = 0;
      dp[0][0] = true;
      for (int j = (1); j <= (26); j += (1)) {
        for (int k = (0); k <= (m); k += (1)) {
          dp[j][k] |= dp[j - 1][k];
          if (k >= freq[j]) {
            dp[j][k] |= dp[j - 1][k - freq[j]];
          }
          if (j == 26 && dp[j][k]) {
            if (k + f >= m) {
              ans = min(ans, 1LL * (m - k) * min(k + f - m, n - (s - f - k)));
            }
          }
        }
      }
      freq[i] = f;
    }
    for (int j = (0); j <= (26); j += (1))
      for (int k = (0); k <= (s); k += (1)) dp[j][k] = 0;
    dp[0][0] = true;
    for (int j = (1); j <= (26); j += (1)) {
      for (int k = (0); k <= (s); k += (1)) {
        dp[j][k] |= dp[j - 1][k];
        if (k >= freq[j]) {
          dp[j][k] |= dp[j - 1][k - freq[j]];
        }
        if (j == 26 && dp[j][k]) {
          if (k >= n && k - n <= s - (n + m) ||
              k >= m && k - m <= s - (n + m)) {
            ans = 0;
          }
        }
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
