## Mock CCC '19 Contest 1 J3 - Pusheen Eats Tuna Sashimi and Tuna Nigiri

View as PDF

Points: 3 (partial)
Time limit: 1.0s
Memory limit: 1G

Problem type

Pusheen has been dreaming about tuna sashimi! She has decided that she needs to eat more tuna in her life, so she decides to visit restaurants to eat tuna sashimi and tuna nigiri.

Each restaurant that Pusheen wishes to visit sells sashimi and nigiri at their own prices - restaurant sets their prices at dollars per piece of tuna sashimi and dollars per piece of tuna nigiri. Pusheen has decided that before tax and tip, the amount of money she spends should be exactly dollars for restaurant . Is it possible for Pusheen to spend exactly dollars on sashimi and nigiri? (Don't worry, she's budgeted money for the tip!)

#### Constraints

In tests worth 3 marks, .

In tests worth an additional 3 marks, will be divisible by .

#### Input Specification

The first line contains a single positive integer , the number of times Pusheen repeats this exercise.

Each of the next lines contains three positive space-separated integers, , , and , indicating that her favourite sushi restaurant is charging dollars per piece for sashimi and dollars per piece for nigiri, and Pusheen's budget purely for the sashimi and nigiri is dollars.

#### Output Specification

Output lines. If Pusheen can order items accordingly from the th restaurant, output YES on the th line. Otherwise, output NO.

#### Sample Input

2
2 2 2
3 4 5

#### Sample Output

YES
NO

#### Sample Explanation

In the first example, Pusheen can order either one piece of sashimi or one piece of nigiri.

In the second example, Pusheen is unable to order exactly 5 dollars of items from sashimi or nigiri. One piece of nigiri costs four dollars, but two pieces of sashimi cost six dollars.