#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
int dp[maxn];
int cnt[27];
char line[maxn];
int main() {
  int n, m, k, t;
  long long ans, x, y;
  scanf("%d", &t);
  while (t--) {
    ans = 1e18;
    memset(cnt, 0, sizeof(cnt));
    scanf("%d%d%d", &n, &m, &k);
    scanf("%s", line + 1);
    for (int i = 1; i <= k; i++) cnt[line[i] - 'A' + 1]++;
    for (int i = 1; i <= 26; i++) {
      for (int j = 0; j <= k; j++) dp[j] = 0;
      dp[0] = 1;
      for (int j = 1; j <= 26; j++) {
        if (i == j) continue;
        for (int l = k; l >= cnt[j]; l--) dp[l] = dp[l] | dp[l - cnt[j]];
      }
      for (int j = 0; j <= k; j++) {
        if (!dp[j]) continue;
        x = max(0, n - j), y = max(0, m - (k - j - cnt[i]));
        if (x + y <= cnt[i]) ans = min(ans, x * y);
      }
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
