#include <bits/stdc++.h>
using namespace std;
template <typename T>
string to_string(const vector<T>& vc, int w) {
  if (vc.empty()) return "";
  if (w + 1 == vc.size()) return to_string(vc[w]);
  return to_string(vc[w]) + "," + to_string(vc, w + 1);
}
template <typename T>
string to_string(const vector<T>& vc) {
  return "{" + to_string(vc, 0) + "}";
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
class DebugStream {
} LOG;
template <typename T>
DebugStream& operator<<(DebugStream& s, const T&) {
  return s;
}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20,
          bs = 26;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n, m, k;
    cin >> n >> m >> k;
    if (n > m) swap(n, m);
    string inp;
    cin >> inp;
    vector<int> dp(k + 1), frq(bs);
    for (auto el : inp) frq[el - 'A']++;
    dp[0] = 1;
    for (int i = 0; i < bs; i++) {
      if (!frq[i]) continue;
      for (int j = k - frq[i]; j >= 0; j--) dp[j + frq[i]] += dp[j];
    }
    int colch = k - n - m;
    long long ans = n * m;
    for (int j = m; j <= m + colch; j++)
      if (dp[j]) ans = 0;
    if (!ans) {
      cout << "0\n";
      continue;
    }
    for (int i = 0; i < bs; i++) {
      if (!frq[i]) continue;
      for (int j = 0; j + frq[i] <= k; j++) dp[j + frq[i]] -= dp[j];
      for (int j = k - frq[i]; j >= 0; j--) {
        dp[j + frq[i]] += dp[j];
        if (!dp[j]) continue;
        if (j < m && m + colch < j + frq[i]) {
          long long uno = m - j, dos = (j + frq[i]) - (m + colch);
          ans = min(ans, uno * dos);
        }
      }
    }
    cout << ans << '\n';
  }
}
