#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int inf = 1791791791;
const int mod = 1e9 + 7;
bool p[N];
int freq[30];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, m, k;
    scanf("%d %d %d", &n, &m, &k);
    for (int i = 0; i < 26; i++) {
      freq[i] = 0;
    }
    for (int i = 0; i < k; i++) {
      p[i + 1] = false;
      char c;
      scanf(" %c", &c);
      freq[c - 'A']++;
    }
    p[0] = true;
    for (int i = 0; i < 26; i++) {
      for (int j = k; j >= 0; j--) {
        if (p[j]) {
          p[j + freq[i]] = true;
        }
      }
    }
    bool found = false;
    for (int j = n; j <= k; j++) {
      if (p[j] && k - j >= m) {
        found = true;
        break;
      }
    }
    for (int j = m; j <= k; j++) {
      if (p[j] && k - j >= n) {
        found = true;
        break;
      }
    }
    if (found) {
      printf("0\n");
      continue;
    }
    int resp = 1000000000;
    for (int i = 0; i < 26; i++) {
      for (int j = 0; j <= k; j++) {
        p[j] = false;
      }
      p[0] = true;
      for (int j = 0; j < 26; j++) {
        if (j == i) continue;
        for (int r = k; r >= 0; r--) {
          if (p[r]) {
            p[r + freq[j]] = true;
          }
        }
      }
      for (int j = n; j >= 0; j--) {
        if (p[j] && j + freq[i] >= n) {
          int r = (n - j);
          int rr = max(m - (k - freq[i] - j), 0);
          resp = min(resp, r * rr);
        }
      }
      for (int j = m; j >= 0; j--) {
        if (p[j] != 0 && j + freq[i] >= m) {
          int r = (m - j);
          int rr = max(n - (k - freq[i] - j), 0);
          resp = min(resp, r * rr);
        }
      }
    }
    printf("%d\n", resp);
  }
  return 0;
}
