#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 1;
map<long long, long long> mp, pm;
deque<long long> v, vc, ve, vv;
deque<char> p, pe;
deque<string> ts, ss, st;
deque<double> sd, ds;
long long a, b, c, d, e, f, cnt, ans, r, n, l, z;
long double q, t, cnt1, cnt2;
string g, h, w, o, m, s;
char y, u;
bool re, rt;
vector<pair<long long, long long> > pr, rp, pp;
map<pair<long long, long long>, long long> aw, wa;
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (long long k = 0; k < n; k++) {
    cin >> a >> b >> c;
    vv.clear();
    v.clear();
    for (long long i = 0; i < a; i++) {
      cin >> d;
      v.push_back(d);
    }
    for (long long i = 0; i < v.size() - c + 1; i++) {
      mp.clear();
      ans = 0;
      for (long long j = 0; j < c; j++) {
        cnt = v[i + j];
        mp[cnt]++;
        if (mp[cnt] == 1) ans++;
      }
      vv.push_back(ans);
    }
    sort(vv.begin(), vv.end());
    cout << vv[0] << endl;
  }
}
