#include <bits/stdc++.h>
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int n, k, d;
    int res = 1000;
    scanf("%d %d %d", &n, &k, &d);
    int cnt[109];
    int a[109];
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
    }
    for (int i = 1; i + d <= n + 1; i++) {
      for (int j = 1; j <= k; j++) {
        cnt[j] = 0;
      }
      for (int j = i; j < i + d; j++) {
        cnt[a[j]]++;
      }
      int num = 0;
      for (int j = 1; j <= k; j++) {
        num += cnt[j] > 0;
      }
      res = std::min(res, num);
    }
    printf("%d\n", res);
  }
}
