#include <bits/stdc++.h>
using namespace std;
const int MAXS = 200005;
const int MAXN = 30005;
const int INF = 1 << 30;
char s[MAXS];
int cnt[30], f[30][MAXN];
int n, m, K;
void work() {
  scanf("%d%d%d%s", &n, &m, &K, s + 1);
  memset(cnt, 0, sizeof(cnt));
  for (int i = 1; i <= K; i++) cnt[s[i] - 'A' + 1]++;
  int res = INF;
  for (int k = 1; k <= 26; k++) {
    for (int i = 0; i <= 26; i++)
      for (int j = 0; j <= n; j++) f[i][j] = 0;
    f[0][0] = 1;
    for (int i = 0; i < 26; i++) {
      for (int j = 0; j <= n; j++) {
        if (f[i][j] == -1) continue;
        f[i + 1][j] |= f[i][j];
        if (i + 1 != k && j + cnt[i + 1] <= n)
          f[i + 1][j + cnt[i + 1]] |= f[i][j];
      }
    }
    for (int j = 0; j <= n; j++) {
      if (f[26][j] && j + cnt[k] >= n) {
        if (K - cnt[k] - j >= m)
          res = 0;
        else {
          int val = (n - j) * (m - (K - cnt[k] - j));
          res = min(res, val);
        }
      }
    }
  }
  printf("%d\n", res);
}
int T;
int main() {
  scanf("%d", &T);
  while (T--) work();
  return 0;
}
