BSSPC '22 P2 - Rhyming Numbers
View as PDFIt is a very well-known fact that Bayview Computer Club currently has exactly executives, and
eleven rhymes with seven.
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.
Constraints
Input Specification
The first line contains a single integer, .
The next lines contain two space-separated integers each,
and
.
Output Specification
For each of the pairs, output on a separate line
YES if the numbers rhyme, or NO otherwise.
Sample Input
5
7 11
11 14
19511 8247
311 6817
7 7
Sample Output
YES
NO
YES
NO
NO
Comments