#include <bits/stdc++.h>
using namespace std;
const int MAXN = 30001;
const int MAXK = 2 * 100000;
int n, m, k;
bitset<1024> b1;
bitset<MAXN> bl;
char tmp[MAXK + 1];
int cnt[26];
using ll = long long;
template <size_t N>
ll SolveBit() {
  bitset<N> b;
  ll answ = n * (ll)m;
  for (int i = 0; i < 26; i++) {
    b.reset();
    b[0] = 1;
    int total = 0;
    for (int j = 0; j < 26; j++) {
      if (i == j) continue;
      b = b | (b << cnt[j]);
      total += cnt[j];
    }
    for (int j = 0; j <= n + m; j++) {
      if (b[j] == 0) continue;
      int rem = total - j;
      int needx = max(n - j, 0);
      int needy = max(m - rem, 0);
      if (needx + needy <= cnt[i]) {
        answ = min(answ, needx * (ll)needy);
      }
    }
  }
  return answ;
}
ll Solve() {
  if (n + m <= 1000)
    return SolveBit<1024>();
  else if (n + m <= 10000)
    return SolveBit<10002>();
  else
    return SolveBit<MAXN>();
}
int main() {
  int T;
  scanf("%d", &T);
  for (int test = 0; test < T; test++) {
    memset(cnt, 0, sizeof(cnt));
    scanf("%d %d %d", &n, &m, &k);
    scanf("%s", tmp);
    for (int i = 0; tmp[i]; i++) cnt[tmp[i] - 'A']++;
    ll answ = Solve();
    printf("%lld\n", answ);
  }
}
