#include <bits/stdc++.h>
using namespace std;
const int N = 2E5 + 10;
const int INF = 0x3f3f3f3f;
int n, m, k;
int cnt[30];
bool dp[30][N];
char a[N];
void Read_Input() {
  scanf("%d%d%d\n", &n, &m, &k);
  scanf("%s", a + 1);
  memset(cnt, 0, sizeof(cnt));
  for (int i = 1; i <= k; i++) cnt[a[i] - 'A' + 1]++;
}
void Solve() {
  int ans = INF;
  dp[0][0] = 1;
  for (int c = 1; c <= 26; c++)
    for (int i = 0; i <= k; i++) {
      dp[c][i] = dp[c - 1][i];
      if (i - cnt[c] >= 0) dp[c][i] |= dp[c - 1][i - cnt[c]];
    }
  for (int i = n; i <= k - m; i++)
    if (dp[26][i]) {
      puts("0");
      return;
    }
  for (int x = 1; x <= 26; x++) {
    for (int c = 1; c <= 26; c++)
      for (int i = 0; i <= k; i++) {
        dp[c][i] = dp[c - 1][i];
        if (c == x) continue;
        if (i - cnt[c] >= 0) dp[c][i] |= dp[c - 1][i - cnt[c]];
      }
    if (cnt[x] == 0) continue;
    for (int i = 0; i <= cnt[x]; i++) {
      int j = n - i + cnt[x] + m - k;
      if (dp[26][max(0, n - i)] && dp[26][max(0, m - j)])
        ans = min(ans, min(n, i) * min(m, j));
    }
  }
  printf("%d\n", ans);
}
int main() {
  int TC;
  scanf("%d\n", &TC);
  while (TC--) {
    Read_Input();
    Solve();
  }
  return 0;
}
