#include <bits/stdc++.h>
using namespace std;
const int E = 30005;
int n, m, k;
char s[200005];
int h[26];
int pass;
int c;
int dp[26][E + 2];
int mark[26][E + 2];
int f(int i, int sum) {
  if (i == 26) {
    int a = sum, b = k - sum - h[c];
    long long ans = 1e9;
    if (max(n - a, 0) + max(m - b, 0) <= h[c])
      ans = 1LL * max(n - a, 0) * max(m - b, 0);
    if (max(n - b, 0) + max(m - a, 0) <= h[c])
      ans = min(ans, 1LL * max(n - b, 0) * max(m - a, 0));
    return int(ans);
  }
  if (i == c) return f(i + 1, sum);
  if (mark[i][sum] == pass) return dp[i][sum];
  mark[i][sum] = pass;
  dp[i][sum] = f(i + 1, sum);
  if (sum + h[i] < E) dp[i][sum] = min(dp[i][sum], f(i + 1, sum + h[i]));
  return dp[i][sum];
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%d %d %d %s", &n, &m, &k, s);
    memset(h, 0, sizeof h);
    for (int i = 0; i < k; i++) h[int(s[i] - 'A')]++;
    int mn = 1e9;
    for (int i = 0; i < 26; i++) {
      c = i;
      pass++;
      mn = min(mn, f(0, 0));
    }
    printf("%d\n", mn);
  }
}
