Time limit: 2.0s
Memory limit: 256M
It is a very well-known fact that Bayview Computer Club currently has exactly executives, and
eleven rhymes with
Inspired by this, you have devised a set of rules for whether two numbers rhyme or not:
- one of the numbers ends in
- the other number ends in
- neither number ends in
For two numbers to rhyme, all three conditions must be satisfied.
Given pairs of numbers, the being and , determine if the numbers rhyme based on your rules.
The first line contains a single integer, .
The next lines contain two space-separated integers each, and .
For each of the pairs, output on a separate line
YES if the numbers rhyme, or
5 7 11 11 14 19511 8247 311 6817 7 7
YES NO YES NO NO