#include <bits/stdc++.h>
using namespace std;
const long long mod1 = 1e9 + 7, mod2 = 1e9 + 9;
const int N = 3e4 + 10;
const int M = 5e3 + 10;
long long power(long long x, unsigned long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
bool dp[30][N];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  srand(time(NULL));
  int t;
  cin >> t;
  while (t--) {
    int n, m, K;
    cin >> n >> m >> K;
    if (m > n) swap(n, m);
    string s;
    cin >> s;
    int freq[27] = {0};
    int i, j, k;
    for (i = 0; i < K; i++) freq[s[i] - 'A']++;
    long long ans = INT_MAX;
    for (i = 1; i <= 26; i++) {
      if (freq[i - 1] == 0) continue;
      for (j = 0; j <= 26; j++) dp[j][0] = true;
      for (j = 1; j <= n; j++) dp[0][j] = false;
      for (j = 1; j <= 26; j++) {
        for (k = 1; k <= n; k++) {
          if (i == j) {
            dp[j][k] = dp[j - 1][k];
            continue;
          }
          if (k < freq[j - 1]) dp[j][k] = dp[j - 1][k];
          if (k >= freq[j - 1])
            dp[j][k] = dp[j - 1][k] || dp[j - 1][k - freq[j - 1]];
        }
      }
      long long x = K - freq[i - 1];
      for (j = 0; j <= min(n, freq[i - 1]); j++) {
        if (dp[26][n - j]) {
          long long y = x - (n - j);
          if (y >= m)
            ans = 0;
          else {
            if ((m - y) <= (freq[i - 1] - j)) ans = min(ans, j * (m - y));
          }
        }
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
