3-sided dice#1828

3-sided dice

3 seconds
256 megabytes
Easy

Just like every fall, the organizers of the Southwestern Europe Dice Simulation Contest are busy again this year. In this edition, you have to simulate a -sided die that outputs each of three possible outcomes (denoted by , , and ) with a given probability, using three dice from a given set. The simulation is performed as follows: you choose one of the given dice at random, roll it, and report its outcome. You are free to choose the probabilities of rolling each of the given dice, as long as each probability is strictly greater than zero. Before distributing the materials to the contestants, the organizers have to verify that it is actually possible to solve this task.

For example, in the first test case of the sample input, you have to simulate a die that yields outcomes , , and with certain probabilities. You are given three dice, and in this case, the -th one always yields outcome , for each i = 1, 2, 3. Then it is possible to simulate the given die in the following way: roll the first die with a certain probability, the second one with another probability, and the last one with a different probability.

Input

The input consists of several test cases, separated by single blank lines. Each test case consists of four lines: the first three describe the three dice you are given and the last one describes the die you have to simulate. Each of the four lines contains space-separated integers between and inclusive. These numbers add up to and represent times the probability that rolling the die described in that line yields outcomes , , and , respectively.

The test cases finish with a line containing only zero repeated three times (also preceded by a blank line).

Output

For each case, output a line with the word YES if it is feasible to produce the desired die from the given ones, and NO otherwise.

Examples

Example 1

Loading
Loading