In this problem you have to answer queries. In each query you are given two integers and . You have to decide if it is possible to represent as the sum of exactly powers of 3 (they may or may not be distinct). If it is possible to represent in such a way then the answer for that query is "YES"(without quotes) otherwise it is a "NO" (without quotes).
Input Format
The first line contains a postive integer - the number of queries.
Each of the next lines contains two space separated integers and .
Constraints
Output Format
For each query, print the answer to that query i.e. "YES"(without quotes) if it is possible to write as the sum of exactly powers of 3 else print "NO"(without quotes).