Buggy python submission (verdict: Runtime Error):
from fractons import gcd
n = int(input())
for i in range(n):
    a,b,c,d = map(int, input().split())
    g = gcd(b,d)
    if a < b or b > d or b-g+(a%g)>c:
        print('No')
    else:
        print('Yes')
 


Fixed submission:
from fractions import gcd
n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
    a,b,c,d = A[i]
    g = gcd(b,d)
    if a < b or b > d or b-g+(a%g)>c:
        print('No')
    else:
        print('Yes')

Buggy python submission (verdict: Runtime Error):
from math import gcd
n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
    a,b,c,d = A[i]
    g = gcd(b,d)
    if a < b or b > d or b-g+(a%g)>c:
        print('No')
    else:
        print('Yes')
 


Fixed submission:
from fractions import gcd
n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
    a,b,c,d = A[i]
    g = gcd(b,d)
    if a < b or b > d or b-g+(a%g)>c:
        print('No')
    else:
        print('Yes')

Buggy python submission (verdict: Runtime Error):
from math import gcd
n = int(input())
for _ in range(n):
    a,b,c,d = map(int, input().split())
    g = gcd(b,d)
    if a < b or b > d or b-g+(a%g) > c:
        print('No')
    else:
        print('Yes')
 


Fixed submission:
from fractions import gcd
n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
    a,b,c,d = A[i]
    g = gcd(b,d)
    if a < b or b > d or b-g+(a%g)>c:
        print('No')
    else:
        print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
t = int(input())
A = [list(map(int, input().split())) for _ in range(t)]
for i in range(t):
    state = True
    a,b,c,d = A[i]
    keep = []
    keep.append(a)
    if a < b:
        state = False
    else:
        while True:
            if a < b:
                state = False
                break
            a -= b
            if a > c:
                if (a-c)%b:
                    a -= (((a-c)//b) + 1)*b
                    if a < 0:
                        state = False
                        break
                else:
                    a = c
            a += d
            if keep.count(a) >= 2:
                temp1 = keep.index(a)
                temp2 = keep[temp1+1:].index(a) + temp1+1
                if keep[temp1:temp2] == keep[temp2:]:
                    break
            keep.append(a)
    if state:
        print('Yes')
    else:
        print('No')


Fixed submission:
from fractions import gcd
n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
    a,b,c,d = A[i]
    g = gcd(b,d)
    if a < b or b > d or b-g+(a%g)>c:
        print('No')
    else:
        print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
t = int(input())
A = [list(map(int, input().split())) for _ in range(t)]
for i in range(t):
    state = True
    a,b,c,d = A[i]
    keep = []
    keep.append(a)
    if a < b:
        state = False
    else:
        a -= b
        if a <= c:
            a += d
        keep.append(a)
        while True:
            if a < b:
                state = False
                break
            a -= b
            if a <= c:
                a += d
            if a in keep:
                if keep[keep.index(a)-1] == keep[-1]:
                    break
            keep.append(a)
    if state:
        print('Yes')
    else:
        print('No')


Fixed submission:
from fractions import gcd
n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]
for i in range(n):
    a,b,c,d = A[i]
    g = gcd(b,d)
    if a < b or b > d or b-g+(a%g)>c:
        print('No')
    else:
        print('Yes')