#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long n, m, k;
    cin >> n >> m >> k;
    vector<long long> f(26);
    for (long long i = 0; i < k; i++) {
      char temp;
      cin >> temp;
      f[temp - 'A']++;
    }
    vector<bool> b(k + 1);
    b[0] = 1;
    long long ans = LONG_LONG_MAX;
    for (long long h = 0; h < 26; h++) {
      for (long long i = 0; i < b.size(); i++) b[i] = 0;
      b[0] = 1;
      for (long long i = 0; i < 26; i++) {
        if (i == h) continue;
        for (long long j = b.size() - 1; j >= f[i]; j--) {
          b[j] = b[j] || b[j - f[i]];
        }
      }
      long long sum = k - f[h];
      for (long long i = 0; i <= sum; i++) {
        if (b[i] == 0 && b[sum - i] == 0) continue;
        if (max(n - i, 0LL) + max(m - (sum - i), 0LL) <= f[h]) {
          ans = min(ans, max(n - i, 0LL) * max(m - (sum - i), 0LL));
        }
      }
    }
    cout << ans << endl;
  }
}
