#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 7;
const int INF = 2e9;
int dp[maxn][2];
int a[maxn];
int n, k, l;
int get(int x) {
  x %= 2 * k;
  if (x <= k - 1) {
    return x;
  } else {
    x -= k - 1;
    return k - x + 1;
  }
}
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d%d", &n, &k, &l);
    int flag = 1;
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      if (a[i] > l) {
        flag = 0;
      }
    }
    dp[0][0] = 0;
    dp[0][1] = k;
    for (int i = 1; i <= n; i++) {
      int mi = dp[i - 1][0], mx = dp[i - 1][1];
      int MI = INF, MX = INF;
      int ok = 0;
      if (mi != INF) {
        if (a[i] + get(mi + 1) <= l) {
          ok++;
          if (mi == k - 1) {
            MX = min(MX, k);
          } else {
            MI = min(MI, mi + 1);
          }
        }
      }
      if (mx != INF) {
        int num = 2 * k - (l - a[i]);
        ok++;
        if (mx == 2 * k - 1 || num == 2 * k) {
          MI = min(MI, 0);
        } else {
          MX = min(MX, max(num, mx + 1));
        }
      }
      if (ok == 0) {
        flag = 0;
        break;
      } else {
        if (MX != INF && a[i] + get(MX) <= l) {
          MI = 0;
        }
        if (a[i] + k <= l) {
          MI = 0;
          MX = k;
        }
      }
      dp[i][0] = MI;
      dp[i][1] = MX;
    }
    if (!flag) {
      printf("NO\n");
    } else {
      printf("YES\n");
    }
  }
  return 0;
}
