#include <bits/stdc++.h>
using namespace std;
int han(int a[], int l, int r, int k, int s[]) {
  for (int i = l, j = 0; i <= r; i++) {
    s[a[i]]++;
  }
  int cot = 0;
  for (int i = 0; i <= k; i++) {
    if (s[i] != 0) cot++;
  }
  return cot;
}
int han2(int a[], int s[], int l, int r, int c) {
  s[a[l - 1]]--;
  if (s[a[l - 1]] == 0) {
    c--;
  }
  s[a[r]]++;
  if (s[a[r]] == 1) {
    c++;
  }
  return c;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int a[200], k, d, b, c, n;
    cin >> n >> k >> d;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    int f = d, s[200] = {0};
    for (int i = d - 1, j = 0; i < n; i++, j++) {
      if (j == 0)
        c = han(a, j, i, k, s);
      else
        c = han2(a, s, j, i, c);
      f = min(c, f);
    }
    cout << f << endl;
  }
}
