#include <bits/stdc++.h>
using namespace std;
const int INF = (int)1e9 + 7;
int dp[30][30005], kol[30];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int test;
  cin >> test;
  for (int rep = 1; rep <= test; rep++) {
    int n, m, k;
    string s;
    cin >> n >> m >> k >> s;
    for (int i = 0; i < 26; i++) kol[i] = 0;
    for (int i = 0; i < k; i++) kol[s[i] - 'A']++;
    int answer = n * m;
    for (int i = 0; i < 26; i++) {
      vector<int> current;
      for (int j = 0; j < 26; j++)
        if (i != j) current.push_back(kol[j]);
      for (int j = 0; j <= 25; j++)
        for (int z = 0; z <= n; z++) dp[j][z] = INF;
      dp[0][0] = 0;
      for (int j = 1; j <= 25; j++)
        for (int z = 0; z <= n; z++) {
          dp[j][z] = dp[j - 1][z];
          if (z >= current[j - 1])
            dp[j][z] =
                min(dp[j][z], dp[j - 1][z - current[j - 1]] + current[j - 1]);
          else
            dp[j][z] = min(dp[j][z], current[j - 1]);
        }
      for (int j = 0; j <= n; j++) {
        int t = dp[25][n - j];
        if (t == INF) continue;
        int p = k - kol[i] - t;
        int nx = max(m - p, 0);
        if (nx + j > kol[i]) continue;
        answer = min(answer, nx * j);
      }
    }
    cout << answer << '\n';
  }
  return 0;
}
