#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<pair<long long, long long>, long long> &a,
               const pair<pair<long long, long long>, long long> &b) {
  return (a.second < b.second);
}
string add(string st1, string st2) {
  long long r = 0;
  string ans;
  ans.resize(3000);
  for (long long i = 2999; i >= 0; i--) {
    long long x = st1[i] - '0';
    long long y = st2[i] - '0';
    long long z = x + y + r;
    if (z >= 10) {
      r = 1;
    } else
      r = 0;
    ans[i] = (z % 10) + '0';
  }
  return ans;
}
long long p(long long x) { return ((x % 1000000007) * 2) % 1000000007; }
long long f(long long h, set<long long> s, long long ans) {
  if (h <= 1) {
    return ans;
  }
  cout << ans << endl;
  long long ans1, ans2, ans3, ans4;
  if (s.find(h - 1) == s.end()) {
    ans1 = f(h - 1, s, ans);
  } else {
    ans1 = f(h - 1, s, ans + 1);
  }
  if (s.find(h - 1) == s.end()) {
    ans2 = f(h - 2, s, ans + 1);
  } else {
    ans2 = f(h - 2, s, ans);
  }
  cout << ans1 << " " << ans2 << "t\n";
  return min(ans1, ans2);
}
long long gcdExtended(long long a, long long b, long long *x, long long *y);
long long modInverse(long long a, long long m) {
  long long x, y;
  long long g = gcdExtended(a, m, &x, &y);
  long long res = (x % m + m) % m;
  return res;
}
long long gcdExtended(long long a, long long b, long long *x, long long *y) {
  if (a == 0) {
    *x = 0, *y = 1;
    return b;
  }
  long long x1, y1;
  long long gcd = gcdExtended(b % a, a, &x1, &y1);
  *x = y1 - (b / a) * x1;
  *y = x1;
  return gcd;
}
long long nCr(long long n, long long r) {
  long long u = 1;
  long long m = 998244353;
  for (long long i = 0; i < r; i++) {
    u = (u * (n - i)) % m;
  }
  long long d = 1;
  for (long long i = 1; i <= r; i++) {
    d = (d * i) % m;
  }
  return (u * modInverse(d, m)) % m;
}
long long Pow(long long a, long long b) {
  if (b == 0) return 1;
  if (a == 0) return 1;
  long long an = 1;
  while (b--) {
    an *= a;
  }
  return an;
}
long long sumofdig(long long x) {
  long long s = 0;
  while (x) {
    s += x % 10;
    x /= 10;
  }
  return s;
}
long long ans = 1e18;
long long n;
long long subc(string &st, string &a) {
  long long c = 0;
  for (long long i = 0; i <= n - 7; i++) {
    string temp;
    for (long long j = 0; j < 7; j++) {
      temp.push_back(st[i + j]);
    }
    if (temp == a) {
      c++;
    }
  }
  return c;
}
bool compare(string &s1, string &s2) {
  if (s1.size() == s2.size()) return s1 > s2;
  return s1.size() < s2.size();
}
int main() {
  long long q;
  cin >> q;
  while (q--) {
    long long n, k, l;
    cin >> n >> k >> l;
    vector<long long> v;
    for (long long i = 0; i < n; i++) {
      long long t;
      scanf("%lld", &t);
      v.push_back(t);
    }
    long long mat[2 * k][n];
    vector<long long> u;
    for (long long i = 0; i <= k; i++) {
      u.push_back(i);
    }
    for (long long i = k - 1; i >= 1; i--) {
      u.push_back(i);
    }
    for (long long j = 0; j < n; j++) {
      long long st = j % (2 * k);
      for (long long i = 0; i < 2 * k; i++) {
        mat[i][j] = v[j] + u[st];
        st = (st + 1) % (2 * k);
      }
    }
    long long vis[2 * k][n];
    for (long long i = 0; i < 2 * k && 0; i++) {
      for (long long j = 0; j < n; j++) {
        cout << mat[i][j] << " ";
        vis[i][j] = 0;
      }
      printf("\n");
    }
    long long f = 0;
    long long r = 0;
    for (long long i = 0; i < 2 * k; i++) {
      queue<pair<long long, long long> > pq;
      for (long long p = 0; p < 2 * k; p++) {
        for (long long j = 0; j < n; j++) {
          vis[p][j] = 0;
        }
      }
      if (mat[i][0] <= l) {
        pq.push(make_pair(i, 0));
      }
      vis[i][0] = 1;
      while (pq.size()) {
        long long x = pq.front().first;
        long long y = pq.front().second;
        pq.pop();
        if (y == n - 1) {
          f = 1;
          break;
        }
        if (mat[x][y + 1] <= l && vis[x][y + 1] == 0) {
          pq.push(make_pair(x, y + 1));
          vis[x][y + 1] = 1;
        }
        x = (x + 1) % (2 * k);
        if (mat[x][y] <= l && vis[x][y] == 0) {
          pq.push(make_pair(x, y));
          vis[x][y] = 1;
        }
      }
      if (f == 1) break;
    }
    if (f == 0)
      printf("NO\n");
    else
      printf("YES\n");
  }
}
