You are given a rectangle matrix of size \(10^{18} \times 10^{18}\). The rows of the matrix are numbered \(1\) to \(10^{18}\) from top to bottom and the columns of the matrix are numbered \(1\) to \(10^{18}\) from left to right. The cell of the field at the intersection of the \(x^{th}\) row and \(y^{th}\) column is represented by \((x,y)\).
A rabbit is standing at cell \((1,1)\). The rabbit can move from a cell \((x,y)\) to a cell \((2\times x,y)\) or \((x,2\times y) \) in a few seconds because of its good speed. Also, it can move to \((x,y-x)\) or \((x-y,y)\).
Note: The rabbit cannot move out of the bounds of the matrix.
You purchase food for the rabbit for the next \(q\) days. You place the food in the cell \((x_i, y_i)\) on the \(i^{th}\) day but you are unsure if these cells are reachable. Your task is to determine if you can reach from the cell \((1,1)\) to the cell \((x_i, y_i)\).
Input format
- First line: Integer \(q\) denoting the number of days
- Next \(q\) lines: Two space-separated integers \(x_i\) and \(y_i\) denoting the coordinates where the food is placed
Output format
For each of \(q\) days, print Yes in a single line if there is a path from cell \((1,1)\) to cell \((x_i, y_i)\) ensuring all the requirements are met. If it is not possible, print No.
Constraints
-
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor