#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
char s[maxn];
int c[26], f[maxn];
int main() {
  int T;
  scanf("%d", &T);
  f[0] = 1;
  while (T--) {
    int a, b, n;
    memset(c, 0, sizeof(c));
    cin >> a >> b >> n;
    scanf("%s", s + 1);
    for (int i = 1; i <= n; i++) c[s[i] - 'A']++;
    int ans = 1e9;
    for (int i = 0; i < 26; i++) {
      for (int j = 1; j <= a; j++) f[j] = 0;
      for (int j = 0; j < 26; j++) {
        if (i == j || c[j] == 0) continue;
        for (int k = a; k >= c[j]; k--) f[k] |= f[k - c[j]];
      }
      for (int j = 0; j <= a; j++)
        if (f[j]) {
          int l = max(0, a - j);
          int r = max(0, b - (n - j - c[i]));
          if (l + r <= c[i]) ans = min(ans, l * r);
        }
    }
    cout << ans << "\n";
  }
}
