#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  for (int i = 0; i <= t - 1; ++i) {
    int n, k, d;
    cin >> n >> k >> d;
    vector<int> v(n);
    for (int i = 0; i <= n - 1; ++i) {
      cin >> v[i];
    }
    int ans = 1e9;
    for (int i = 0; i <= n - d; ++i) {
      int tmp = 0;
      vector<bool> used(k + 1);
      for (int j = i; j <= i + d - 1; ++j) {
        if (!used[v[j]]) {
          used[v[j]] = 1;
          tmp++;
        }
      }
      ans = min(ans, tmp);
    }
    cout << ans << '\n';
  }
  return 0;
}
