#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc;
  cin >> tc;
  while (tc--) {
    int n, k, d, ans = 100;
    cin >> n >> k >> d;
    vector<int> num(n);
    vector<vector<bool> > channel(n, vector<bool>(k + 1));
    for (int i = 0, cur; i < n; i++) {
      cin >> cur;
      for (int j = 0; j < d && i + j < n; j++) {
        if (!channel[i + j][cur]) {
          channel[i + j][cur] = true;
          num[i + j]++;
        }
      }
      if (i + 1 >= d) {
        ans = min(ans, num[i]);
      }
    }
    cout << ans << '\n';
  }
}
