#include <bits/stdc++.h>
using namespace std;
bool dp[27][31000];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  for (int jjjj = (0); jjjj < (t); jjjj++) {
    int n, m, k;
    cin >> n >> m >> k;
    string str;
    cin >> str;
    int cnts[27];
    memset(cnts, 0, sizeof(cnts));
    for (int i = (0); i < (str.size()); i++) {
      cnts[str[i] - 'A']++;
    }
    vector<int> vec;
    for (int j = (0); j < (27); j++) {
      if (cnts[j]) {
        vec.push_back(cnts[j]);
      }
      memset(&dp[j], 0, n + 10);
    }
    for (int w = (0); w < (27); w++) {
      dp[w][0] = true;
      for (int i = 0; i < vec.size(); i++) {
        if (i == w) continue;
        for (int j = n + 2; j >= vec[i]; j--) {
          dp[w][j] |= dp[w][j - vec[i]];
        }
      }
    }
    int ans = n * m;
    for (int j = n; j >= 0; j--) {
      for (int p = 0; p < vec.size(); p++) {
        if (!dp[p][j]) continue;
        int rem = n - j;
        if (vec[p] < rem) continue;
        int m_others = min(m, k - j - vec[p]);
        int m_left = m - m_others;
        int rem2 = vec[p] - rem;
        if ((k - rem2) >= (n + m)) {
          ans = 0;
        } else {
          ans = min(ans, rem * m_left);
        }
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
