#include <bits/stdc++.h>
using namespace std;
const int N = 30005;
int n, m, k;
string s;
void solve() {
  cin >> n >> m >> k >> s;
  vector<int> cn(27, 0);
  for (char c : s) {
    cn[c - 'A']++;
  }
  int ans = m * n;
  for (int i = 0; i < 26; i++) {
    vector<bool> f(k - cn[i] + 1, 0);
    f[0] = 1;
    for (int j = 0; j < 26; j++)
      if (j != i) {
        for (int t = k - cn[i]; t + 1; t--) {
          if (f[t]) f[t + cn[j]] = 1;
        }
      }
    for (int j = 0; j <= k - cn[i]; j++)
      if (f[j]) {
        int x = max(0, n - j);
        int y = max(0, m - (k - cn[i] - j));
        if (x + y > cn[i]) continue;
        ans = min(ans, x * y);
      }
  }
  cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T;
  cin >> T;
  while (T--) solve();
}
