HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Algorithms and Data Structures > problem:


24. Coin Piles

Volume problems

• 14. Increasing Array
• 15. Bit Strings
• 16. Josephus Queries
• 18. Apartments
• 19. Ferris Wheel
• 20. Two Sets
• 21. Distinct Numbers
• 22. Creating Strings
• 24. Coin Piles
• 27. Dice Combinations
• 28. Minimizing Coins
• 30. Distinct Numbers
• 31. Apartments
• 32. Ferris Wheel
• 33. Concert Tickets
• 34. Maximum Subarray Sum
• 35. Stick Lengths

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 3000/5000/5000/5000 ms. Memory limit 65000/65000/65000/65000 Kb. Difficulty Alpha


You have two coin piles containing a and b coins. On each move, you can either remove one coin from the left pile and two coins from the right pile, or two coins from the left pile and one coin from the right pile.

Your task is to efficiently find out if you can empty both the piles.

Input

The first input line has an integer t: the number of tests.

After this, there are t lines, each of which has two integers a and b: the numbers of coins in the piles.

Output

For each test, print "YES" if you can empty the piles and "NO" otherwise.

Constraints

1≤t≤105
0≤a,b≤109

Example
Input:
3
2 1
2 2
3 3

Output:
YES
NO
YES

Для отправки решений необходимо выполнить вход.

www.contester.ru