#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int n, k, d;
  int cou[100 + 2], dem, j, a[100 + 2], mi, i;
  while (t--) {
    cin >> n >> k >> d;
    dem = 0;
    mi = 102;
    memset(cou, 0, sizeof(cou));
    for (i = 0; i < n; i++) {
      cin >> a[i];
      if (cou[a[i]] == 0) {
        cou[a[i]]++;
        dem++;
      } else
        cou[a[i]]++;
      if (i >= d - 1) {
        mi = min(mi, dem);
        cou[a[i - (d - 1)]]--;
        if (cou[a[i - (d - 1)]] == 0) dem--;
      }
    }
    cout << mi << "\n";
  }
}
