#include <bits/stdc++.h>
using namespace std;
void bang() {
  int n, k, d;
  cin >> n >> k >> d;
  vector<int> v(n);
  for (auto& it : v) cin >> it;
  int i = d - 1;
  deque<int> dq;
  for (int j = 0; j < d; j++) dq.push_back(v[j]);
  int ans = INT_MAX;
  while (i < n) {
    set<int> st;
    for (auto it : dq) st.insert(it);
    ans = min(ans, (int)st.size());
    i++;
    dq.pop_front();
    dq.push_back(v[i]);
  }
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int q;
  cin >> q;
  while (q--) bang();
  return 0;
}
