#include <bits/stdc++.h>
using namespace std;
template <typename T>
bool chmin(T &a, const T &b) {
  return a > b ? a = b, true : false;
}
template <typename T>
bool chmax(T &a, const T &b) {
  return a < b ? a = b, true : false;
}
const int maxK = 200000 + 233;
const long long P = 1926081700000000009;
int n, m, k;
vector<long long> f;
string s;
int cnt[26];
void inc(long long &x, long long y) { (x += y) >= P ? x -= P : 233; }
void dec(long long &x, long long y) { (x -= y) < 0 ? x += P : 233; }
void insert(int x) {
  for (int i = n - 1 - x; i >= 0; --i) inc(f[i + x], f[i]);
}
void erase(int x) {
  for (int i = 0; i <= n - 1 - x; ++i) dec(f[i + x], f[i]);
}
long long initialize() {
  cin >> n >> m >> k;
  cin >> s;
  memset(cnt, 0, sizeof(cnt));
  for (char c : s) {
    cnt[(int)c - 'A']++;
  }
  f.assign(n, 0);
  f[0] = 1;
  for (int i = 25; i >= 0; --i)
    if (cnt[i]) insert(cnt[i]);
  long long ans = (long long)n * m;
  for (int i = 0; i < 26; ++i)
    if (cnt[i]) {
      int d = cnt[i];
      erase(d);
      for (int j = n - 1; j >= n - d && j >= 0; --j)
        if (f[j]) {
          if (k - (j + d) >= m) return 0;
          chmin(ans, (n - j) * (long long)(m - k + j + d));
        }
      insert(d);
    }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  while (T--) {
    cout << initialize() << '\n';
  }
  return 0;
}
