#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int MOD = int(1e9) + 7;
template <typename T>
inline T gcd(T a, T b) {
  while (a && b) a > b ? a %= b : b %= a;
  return a + b;
}
inline bool Palindrome(const string& s) {
  return equal(s.begin(), s.end(), s.rbegin());
}
const int N = 30000;
const int K = 200000;
void solve() {
  int n, m, k;
  cin >> n >> m >> k;
  string s;
  cin >> s;
  vector<int> cnt(26, 0);
  for (char c : s) {
    cnt[c - 'A']++;
  }
  vector<int> can(k + 1, 0);
  can[0] = 1;
  for (int i = 0; i < 26; ++i) {
    for (int j = k; j >= 0; --j) {
      if (can[j] && j + cnt[i] <= k) {
        can[j + cnt[i]] = 1;
      }
    }
  }
  for (int j = n; j <= k; ++j) {
    if (can[j] && k - j >= m) {
      cout << "0\n";
      return;
    }
  }
  long long ans = 1e18L;
  for (int bad = 0; bad < 26; ++bad) {
    if (cnt[bad] == 0) continue;
    fill(can.begin(), can.end(), 0);
    can[0] = 1;
    for (int i = 0; i < 26; ++i) {
      if (i == bad) continue;
      for (int j = k; j >= 0; --j) {
        if (can[j] && j + cnt[i] <= k) {
          can[j + cnt[i]] = 1;
        }
      }
    }
    for (int i = 0; i <= n; ++i) {
      if (can[i] == 0) continue;
      if (cnt[bad] < n - i) continue;
      int for_m = k - i - cnt[bad];
      ans = min(ans, 1ll * (n - i) * max(0, m - for_m));
    }
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
