#include<bits/stdc++.h>
using namespace std;
int cnt[26];
void work() {
memset(cnt,0,sizeof cnt);
int n, m, k;
string s;
cin >> n >> m >> k >> s;
for(char c : s) cnt[c - 'A']++;
int ans = n * m;
for(int i = 0 ; i < 26 ; ++i) {
vector<bool> f(k - cnt[i] + 1,0);
f[0] = 1;
for(int j = 0 ; j < 26 ; ++j) if (i != j)
for(int l = k - cnt[i] ; l >= 0 ; --l)
if (f[l]) f[l + cnt[j]] = 1;
for(int j = 0 ; j <= k - cnt[i] ; ++j) if (f[j]) {
int x = max(0,n - j);
int y = max(0,m + j + cnt[i] - k);
if (x + y <= cnt[i])
ans = min(ans,x * y);
}
}
cout << ans << "\n";
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t; cin >> t;
while(t--) work();
}