#include <bits/stdc++.h>
using namespace std;
const int S = 26;
const int maxn = 2e5 + 5;
int cnt[S];
bool dp[maxn];
char St[maxn];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, m, s;
    cin >> n >> m >> s;
    memset(cnt, 0, sizeof(cnt));
    cin >> St;
    long long ans = 1e18 + 5;
    for (int i = 0; i < s; i++) cnt[St[i] - 'A']++;
    for (int i = 0; i < 26; i++) {
      if (cnt[i] == 0) continue;
      memset(dp, false, sizeof(dp));
      dp[0] = true;
      for (int j = 0; j < 26; j++) {
        if (i == j) continue;
        if (cnt[j] != 0)
          for (int k = n - cnt[j]; k >= 0; k--)
            if (dp[k]) dp[k + cnt[j]] = 1;
      }
      for (int k = max(n - cnt[i], 0); k <= n; k++)
        if (dp[k]) ans = min(ans, 1ll * (n - k) * max(0, m - (s - k - cnt[i])));
    }
    cout << ans << endl;
  }
}
