#include <bits/stdc++.h>
using namespace std;
int key(int x);
int main() {
  int t;
  cin >> t;
  int str[t];
  for (int u = 0; u < t; u++) {
    str[u] = key(u);
  }
  for (int u = 0; u < t; u++) cout << str[u] << "\n";
  return 0;
}
int key(int x) {
  int n, k, d, mini = 1000, m = 0;
  cin >> n >> k >> d;
  int arr[n], c = 0;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int j = 0; j < n - d + 1; j++) {
    for (int a = 0; a < d; a++) {
      m = 0;
      for (int b = 0; b <= a; b++) {
        if (arr[j + a] == arr[j + b])
          m++;
        else
          continue;
      }
      if (m <= 1) c++;
    }
    mini = min(mini, c);
    c = 0;
  }
  return mini;
}
