#include <bits/stdc++.h>
using namespace std;
int vis[105];
int a[105], tot;
void solve(int T) {
  int n, k, d, sum = 0;
  tot = 105;
  memset(vis, 0, sizeof(vis));
  scanf("%d%d%d", &n, &k, &d);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < d; i++) {
    if (vis[a[i]] == 0) sum++;
    vis[a[i]]++;
  }
  tot = min(tot, sum);
  for (int i = d; i < n; i++) {
    if (vis[a[i]] == 0) sum++;
    vis[a[i]]++;
    vis[a[i - d]]--;
    if (vis[a[i - d]] == 0) sum--;
    tot = min(tot, sum);
  }
  printf("%d\n", tot);
}
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 1; i <= t; i++) solve(i);
}
