Under construction

Still being built. Things may change

Factory

Time limit2sMemory limit1024 MB

Summary
Given room counts a and b, decide whether repeatedly doubling the smaller room with people from the larger one can make both rooms equal.
Level

Medium5 of 10

Topics
Number theory, Math
Solved
No attempts yet

Problem

Machines use the body heat and electrical activity of people to produce energy. They even have their own factories to produce and process this energy.

In one of these factories, energy is produced as follows. People are placed in two rooms. In the first room, heat is taken from each person, and in the second room, electrical activity is taken. For the most productive energy production, both rooms must hold the same number of people.

An hour ago, a riot broke out. Some people escaped, and the rest got mixed up. Now the first room holds aa people and the second room holds bb. The machines want both rooms to hold the same number of people. However, their software only lets them double the number of people in the room with fewer people, using people taken from the other room. For example, if the first room has three people and the second has five, one step can move three people from the second room to the first. Can the machines make the counts equal with these operations?

Input

The first line contains an integer nn (1≤n≤1051 \le n \le 10^5), the number of test cases. Each of the next nn lines contains two integers aa and bb (1≤a,b≤1091 \le a, b \le 10^9).

Output

For each test case, print <<YES>> if the machines can make the number of people in the two rooms equal, and <<NO>> otherwise. Print one answer per line.

Examples1

  1. Example 1

    Input
    3
    2 6
    1 5
    4 4
    
    Expected output
    YES
    NO
    YES