#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v, c, m;
  int n, k, d, p;
  int z = 0;
  bool kev = false;
  cin >> p;
  for (int r = 0; r < p; r++) {
    v.clear();
    cin >> n >> k >> d;
    int lj = k;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      v.push_back(x);
    }
    for (int i = 0; i < n + 1 - d; i++) {
      for (int l = 0; l < d; l++) {
        c.push_back(v[l + i]);
      }
      for (int l = 0; l < k; l++) {
        for (int f = 0; f < d; f++) {
          if (l + 1 == c[f]) {
            kev = true;
          } else {
          }
        }
        if (kev == true) {
          z++;
          kev = false;
        }
      }
      lj = min(z, lj);
      c.clear();
      z = 0;
    }
    m.push_back(lj);
  }
  for (int i = 0; i < m.size(); i++) {
    cout << m[i] << endl;
  }
  return 0;
}
