as you can see it got accepted
Looks like the test cases are just weak. Try the following input:
7
3 483197
9 483197
10 79076
10 790760
19 14789
19 280991
24 734341
Your solution reports YES for all of these cases. And the @utkarsh_adm’s solution from the editorial reports NO.