#include <bits/stdc++.h>
using namespace std;
int n, m, len;
char s[200050];
int a[26];
int dp[200050];
void init() {
  memset(a, 0, sizeof(a));
  scanf("%d%d%d%s", &n, &m, &len, s);
  for (int i = 0; i < len; ++i) ++a[s[i] - 'A'];
  if (n > m) swap(n, m);
}
long long ans;
void calc(int vn, int vm, int c) {
  if (vn + c < n) return;
  if (vm >= m)
    ans = 0;
  else
    ans = min(ans, 1LL * (n - vn) * (m - vm));
}
void solve() {
  ans = 1LL << 60;
  for (int k = 0; k < 26; ++k) {
    for (int j = 0; j <= n; ++j) dp[j] = 0;
    for (int i = 0; i < 26; ++i)
      if (i != k)
        for (int j = n; j >= a[i]; --j) dp[j] = max(dp[j], dp[j - a[i]] + a[i]);
    for (int j = 0; j <= n; ++j) calc(dp[j], len - a[k] - dp[j], a[k]);
  }
  printf("%lld\n", ans);
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    init();
    solve();
  }
  return 0;
}
