#include <bits/stdc++.h>
using namespace std;
int64_t T, m, n, k, C[30], f[200005];
int main() {
  cin >> T;
  while (T--) {
    cin >> m >> n >> k;
    if (m < n) swap(m, n);
    for (int64_t i = 0; i < 26; i++) C[i] = 0;
    char c;
    for (int64_t i = 1; i <= k; i++) {
      cin >> c;
      C[c - 'A']++;
    }
    int64_t res = 1e9;
    for (int64_t i = 0; i < 26; i++)
      if (C[i] > 0) {
        f[0] = 1;
        for (int64_t j = 1; j <= k; j++) f[j] = 0;
        for (int64_t j = 0; j < 26; j++)
          if (i != j)
            for (int64_t t = k; t >= C[j]; t--) f[t] |= f[t - C[j]];
        for (int64_t j = 1; j <= min(C[i], m); j++)
          if (f[m - j] == true) {
            int64_t t1 = j;
            int64_t t2 = max(C[i] - j - (k - m - n), int64_t(0));
            res = min(res, t1 * t2);
          }
      }
    cout << res << "\n";
  }
}
