Help me in solving BMC08 problem

My issue

BMC08 how is this question solved with out for loop
t = int(input())
for i in range(t):
A, B = map(int, input().split())
operation_num = 0
for j in range(A,B+1):
operation_num = operation_num +1
if A != B and operation_num%2==0:
A = A+2
elif A != B and operation_num%2 != 0:
A = A+1

    if A==B:
        print('YES')
        break
    elif A > B:
        print('NO')
        break

the above code is giving error

My code

# Update the code below to solve the problem

t = int(input())
for i in range(t):
    A, B = map(int, input().split())
    operation_num = 0
    for j in range(A,B+1):
        operation_num = operation_num +1
        if A != B and operation_num%2==0:
            A = A+2
        elif A != B and operation_num%2 != 0:
            A = A+1
            
        if A==B:
            print('YES')
            break
        elif A > B:
            print('NO')
            break

Learning course: Beginner DSA in Python
Problem Link: CodeChef: Practical coding for everyone

@satish24
plzz refer the following solution

t = int(input())
for i in range(t):
    A, B = map(int, input().split())
    
    diff = B - A
    
    if (B - A)%3 == 0:
        print('YES')
    elif (B - A)%3 == 1:
        print('YES')
    else:
        print('NO')