#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  for (int i = 0; i < t; ++i) {
    int n, k, d;
    cin >> n >> k >> d;
    vector<int> ar(n, 0);
    for (int j = 0; j < n; ++j) {
      cin >> ar[j];
    }
    int ans = 1e9;
    for (int j = 0; j <= n - d; ++j) {
      vector<int> used(k + 1, 0);
      int cnt = 0;
      for (int q = j; q < j + d; ++q) {
        if (used[ar[q]] == 0) {
          cnt += 1;
          used[ar[q]] = 1;
        }
      }
      ans = min(ans, cnt);
    }
    cout << ans << endl;
  }
}
