
def main():
    t = int(input())
    A=[]
    B=[]
    C=[]
    D=[]

    for i in range(t):
        a,b,c,d = map(int,input().split())
        A.append(a)
        B.append(b)
        C.append(c)
        D.append(d)


    for i in range(t):

        if A[i] < B[i] or B[i] > D[i]:
            print("No")
            continue

        if B[i]-1 <= C[i]:
            print("Yes")
            continue

        lst = []
        for j in range(B[i]):
            tmp = (A[i] + (j*D[i])) % B[i]

            if tmp > C[i]:
                print("No")
                break

            if tmp in lst:
                break

            lst.append(tmp)

        print("Yes")


if __name__ == "__main__":
        main()
