#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int t;
  cin >> t;
  for (int h = 0; h < t; h++) {
    int n, k, d, c, ans = 0, res = 1e9;
    cin >> n >> k >> d;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
      cin >> c;
      a[i] = c;
    }
    for (int i = 0; i <= n - d; i++) {
      vector<bool> b(k);
      ans = 0;
      for (int j = i; j < i + d; j++) {
        if (!b[a[j]]) {
          ans++;
          b[a[j]] = 1;
        }
      }
      res = min(res, ans);
    }
    cout << res << endl;
  }
}
