#include <bits/stdc++.h>
using namespace std;
using pii = pair<long long, long long>;
using ll = long long;
using vi = vector<long long>;
using vll = vector<long long>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vpii = vector<pair<long long, long long>>;
using vd = vector<double>;
using pdd = pair<double, double>;
using pss = pair<string, string>;
signed main() {
  long long t;
  cin >> t;
  for (long long i = 0; i < t; i++) {
    long long n, k, l;
    cin >> n >> k >> l;
    vector<long long> v(n);
    for (long long& j : v) cin >> j;
    long long prev = -1;
    bool ans = true;
    while (prev < n) {
      long long al = 0;
      long long best = prev;
      long long j = prev + 1;
      long long prevj = j;
      while (j < n) {
        while (j < n && al + v[j] <= l && al <= k) {
          if (v[j] + k <= l) best = j;
          al++;
          j += 1;
        }
        if (j >= n) break;
        j = best + 1;
        al = min(k, l - v[j]);
        while (j < n) {
          if (al < 0) break;
          if (al == 0) {
            j += 1;
            break;
          }
          j += 1;
          if (l - v[j] >= 0 && l - v[j] < al)
            al = l - v[j];
          else if (l - v[j] >= 0)
            al--;
          else
            break;
          if (v[j] + k <= l) best = j;
        }
        if (j == prevj) break;
        prevj = j;
        al += 1;
      }
      if (best == prev && j != n) {
        ans = false;
        break;
      } else
        prev = best;
      if (j >= n) break;
    }
    if (ans)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
