Learn DSADSAContests
coding75 logo
LeetCode POTDPOTDSheets
coding75 Pro
coding75 logo
Dashboard
Learn DSA
Course RoadmapFlow
DSA Topic TreeNew πŸš€
Contest SolutionsPractice
Practice Sheets
MasterclassesLive πŸ‘¨πŸ»β€πŸ’»

coding75 ProPRO

Live Classes & Placement Guidance

coding75 logo

The premier developer platform for mastering Data Structures & Algorithms, exploring contest editorials, building ATS-ready resumes, and accelerating your tech career.

Connect & Community

DSA & Contests

  • Learn DSA
  • Contest Solutions
  • LeetCode POTDDaily
  • Practice Sheets
  • MasterclassesSoon

Interview Prep

  • Portfolio Projects
  • CS Fundamentals
  • System DesignSoon
  • Interview ExperiencesSoon
  • Mock InterviewsSoon

Career & Pro

  • Jobs & Internships
  • Resume BuilderATS
  • coding75 Pro
  • Submit Feedback
Β© 2026coding75β€’crackDSAβ„’β€’Maa Lalita Edtech Private Limited. All Rights Reserved.
Privacy PolicyTerms & ConditionsContact Support
Registered Office: Kanpur 208021β€’Regional Office: Indiranagar, Bangalore, 560008
Maa Lalita Edtech Private Limited
Contests/Codeforces/Codeforces Round 1096 (Div. 3)/A. Koshary
Next
CodeforcesCodeforces
Newbie
Codeforces Round 1096 (Div. 3)

A. Koshary

MathGeometry
Loading...
Solve on Codeforces

Problem Statement

Official algorithmic problem description and constraints.

Open on Codeforces

Yousef is at the coordinates (0,0)

 and wants to reach a plate of Koshary at (π‘₯,𝑦)

.

To get there, Yousef takes long steps. From any point (π‘Ž,𝑏)

, a long step moves him to:

  • (π‘Ž+2,𝑏)
  •  or (π‘Ž,𝑏+2)

However, Yousef is allowed to take at most one short step during his entire journey. A short step moves him to:

  • (π‘Ž+1,𝑏)
  •  or (π‘Ž,𝑏+1)

Can Yousef reach the exact coordinates (π‘₯,𝑦)

 of the Koshary plate?

Input


The first line contains an integer π‘‘

 (1≀𝑑≀100

) β€” the number of test cases.

Each test case contains two integers π‘₯

 and π‘¦

 (1≀π‘₯,𝑦≀10

) β€” the coordinates of the Koshary plate.

Output


For each test case, output "YES" if Yousef can reach the Koshary plate and "NO" otherwise.

You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.

Example

Input

Copy

6
1 1
1 2
4 6
5 9
7 2
10 10

Output

Copy

NO
YES
YES
NO
YES
YES

Note


In the first test case, it is impossible to reach (1,1)

 using the mentioned steps.

In the second test case, an optimal sequence of steps would be:

(0,0)βˆ’

β†’

βˆ’

βˆ’

πš•πš˜πš—πš

(0,2)βˆ’

β†’

βˆ’

βˆ’

βˆ’

πšœπš‘πš˜πš›πš

(1,2)

In the third test case, an optimal sequence of steps would be:

(0,0)βˆ’

β†’

βˆ’

βˆ’

πš•πš˜πš—πš

(0,2)βˆ’

β†’

βˆ’

βˆ’

πš•πš˜πš—πš

(2,2)βˆ’

β†’

βˆ’

βˆ’

πš•πš˜πš—πš

(2,4)βˆ’

β†’

βˆ’

βˆ’

πš•πš˜πš—πš

(4,4)βˆ’

β†’

βˆ’

βˆ’

πš•πš˜πš—πš

(4,6)


Solutions & Walkthrough

Detailed video explanations, mathematical intuition, and clean C++ implementation code.

Connecting secure classroom stream...
Back to Codeforces Round 1096 (Div. 3)
Next Problem