## Weights solution codechef

**Solution – CLICK HERE**

Chef is playing with weights. He has an object weighing $W$ units. He also has three weights each of $X,Y,$ and $Z$ units respectively. Help him determine whether he can measure the **exact** weight of the object with one or more of these weights.

If it is possible to measure the weight of object with one or more of these weights, print `YES`

, otherwise print `NO`

.

## Weights solution codechef

- The first line of input will contain a single integer $T$, denoting the number of test cases.
- Each test case consists of single line containing a four positive integers $W,X,Y,$ and $Z$.

## Weights solution codechef

For each test case, output on a new line `YES`

if it is possible to measure the weight of object with one or more of these weights, otherwise print `NO`

.

You may print each character of the string in either uppercase or lowercase (for example, the strings `yes`

, `YES`

, `Yes`

, and `yeS`

will all be treated as identical).

## Weights solution codechef

- $1≤T≤1_{4}$
- $1≤W,X,Y,Z≤1_{5}$

## Weights solution codechef

Input

Output

4 5 2 1 6 7 9 7 2 20 8 10 12 20 10 11 12

NO YES YES NO

## Weights solution codechef

**Test Case $1$:** It is not possible to measure $5$ units using any combination of given weights.

**Test Case $2$:** Chef can use the second weight of $7$ units to measure the object exactly.

**Test Case $3$:** Chef can use combination of first and third weights to measure $8+12=20$ units.

**Test Case $4$:** Chef cannot measure $20$ units of weight using any combination of given weights.