思路:经典博弈论结论题。巴什博弈:一堆有n个石子,每次可以取1~m个石子,取走最后一个石子的人获胜。问先手和后手谁会赢?结论就是:当时,先手必败;当时,先手必胜。然后我们就根据这个结论来进行答案的收集,最终输出结果即可

补充:尼姆博弈:有堆石子,每堆石子有个,如果每堆石子数的异或和为0,则先手必输;否则先手必胜。

代码:

import sys
input = lambda: sys.stdin.readline().strip()

import math
inf = 10 ** 18

def I():
    return input()

def II():
    return int(input())

def MII():
    return map(int, input().split())

def GMI():
    return map(lambda x: int(x) - 1, input().split())

def LI():
    return input().split()

def LII():
    return list(map(int, input().split()))

def LFI():
    return list(map(float, input().split()))

fmax = lambda x, y: x if x > y else y
fmin = lambda x, y: x if x < y else y
isqrt = lambda x: int(math.sqrt(x))

'''

'''

out = []

def solve():
    n, m = MII()
    if n % (m + 1) == 0:
        out.append("NO")
    else:
        out.append("YES")

# t = 1
t = II()
for _ in range(t):
    solve()

print('\n'.join(out))