#include <bits/stdc++.h>
using namespace std;
int f[100500];
int a[30];
char buf[200500];
void solve() {
  int W, H;
  scanf("%d %d", &W, &H);
  if (W > H) swap(W, H);
  memset(a, 0, sizeof a);
  int k;
  scanf("%d", &k);
  scanf("%s", buf);
  for (int i = (0); i < (k); ++i) ++a[buf[i] - 'A'];
  int L = W + W + H;
  int s = 0;
  for (int i = (0); i < (26); ++i) a[i] = min(a[i], W + H);
  for (int i = (0); i < (26); ++i) s += a[i];
  f[0] = 1 << 30;
  for (int i = (0); i < (26); ++i)
    if (int x = a[i]) {
      for (int j = (L - x); j >= (0); --j)
        if (f[j]) f[j + x] |= (f[j] | (1 << i));
    }
  long long res = 1000000000LL;
  for (int q = (W); q <= (L); ++q)
    for (int i = (0); i < (26); ++i)
      if (f[q] & (1 << i))
        if (q - a[i] <= W) {
          long long p1 = W - (q - a[i]);
          long long p2 = max(0, H - (s - q));
          if (p1 + p2 > a[i]) continue;
          res = min(res, p1 * p2);
        }
  printf("%I64d\n", res);
  for (int i = (0); i <= (L); ++i) f[i] = 0;
}
int main() {
  int ntc;
  scanf("%d", &ntc);
  while (ntc--) solve();
}
