#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, k, d, x;
  cin >> t;
  for (x = 0; x < t; x++) {
    cin >> n >> k >> d;
    int min = k;
    int a[n];
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    int b[d];
    for (int i = 0; i <= n - d; i++) {
      int l = i;
      for (int j = 0; j < d; j++) {
        b[j] = a[l];
        l++;
      }
      sort(b, b + d);
      int res = 0;
      for (int j = 0; j < d; j++) {
        while (j < d - 1 && b[j] == b[j + 1]) j++;
        res++;
      }
      if (res < min) min = res;
    }
    cout << min << "\n";
  }
  return 0;
}
