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