#include <bits/stdc++.h>
using namespace std;
long long a[300010];
long long p[600010];
bool ok[300010];
int main() {
  long long t, n, m, i, j, k, l, it;
  scanf("%lld", &t);
  while (t--) {
    scanf("%lld %lld %lld", &n, &k, &l);
    for (i = 0; i <= k; i++) p[i] = i;
    for (; i < 2 * k; i++) p[i] = k - (i % k);
    for (i = 0; i < n; i++) scanf("%lld", &a[i]);
    for (i = 0; i < n; i++) {
      if (a[i] + k <= l)
        ok[i] = 1;
      else
        ok[i] = 0;
    }
    ok[n] = 1;
    long long res = 0, ans = 1;
    vector<long long> v;
    for (it = 0; it <= n; it++) {
      if (ok[it] == 0) {
        v.push_back(a[it]);
      } else {
        long long sz = v.size();
        if (sz == 0) continue;
        res = 0;
        for (i = 0; i < sz; i++) {
          long long in = 0;
          long long b = 1;
          long long mx = v[i];
          for (j = i - 1; j >= 0; j--, b++) {
            mx = max(mx, v[j] + p[b % (2 * k)]);
          }
          b = 1;
          for (j = i + 1; j < sz; j++, b++) {
            mx = max(mx, v[j] + p[b % (2 * k)]);
          }
          if (mx <= l) res = 1;
        }
        v.clear();
        if (res == 0) ans = 0;
      }
    }
    if (ans)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
