#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n = 0;
  cin >> n;
  while (n--) {
    int a = 0, b = 0, d = 0;
    cin >> a >> b >> d;
    vector<long long> v;
    int size = INT_MAX;
    set<int> s;
    for (int i = 0; i < a; i++) {
      int x = 0;
      cin >> x;
      v.push_back(x);
    }
    for (int i = 0; i < a; i++) {
      if ((i + (d - 1)) < a) {
        for (int j = i; j < d + i; j++) {
          s.insert(v[j]);
        }
        auto p = s.size();
        if (size > p) {
          size = p;
        }
        s.clear();
      }
    }
    cout << size << "\n";
  }
  return 0;
}
