#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const long long inf = 1e18;
int ntest;
int n, m, k;
string s;
int cnt[55];
bool ok[maxn];
void read_input() {
  cin >> n >> m >> k;
  cin >> s;
}
void solve() {
  fill(cnt, cnt + 26, 0);
  for (int i = 0; i < k; ++i) ++cnt[s[i] - 'A'];
  long long ans = inf;
  for (int i = 0; i < 26; ++i) {
    fill(ok + 1, ok + k + 1, false);
    ok[0] = true;
    for (int j = 0; j < 26; ++j)
      if (j != i) {
        for (int sum = k - cnt[i]; sum >= 0; --sum)
          if (ok[sum]) ok[sum + cnt[j]] = true;
      }
    for (int sum = 0; sum <= n; ++sum) {
      if (!ok[sum]) continue;
      int xn = n - sum;
      int xm = max(0, m - (k - cnt[i] - sum));
      if (xn + xm > cnt[i]) continue;
      ans = min(ans, xn * 1LL * xm);
    }
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> ntest;
  while (ntest--) {
    read_input();
    solve();
  }
}
