Magic Rabbit
题号:NC232532
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Little Rabbit is a magic rabbit living in human society. He drinks magic potion every day to disguise himself as a human. To make the potion, Little Rabbit needs to find two kinds of magic material, USAO and Camellia, and dissolve them in water.

One day, Little Rabbit wants to make some potion, but he's surprised to find that the materials are all used up, including the magic materials and the water. Luckily, Little Rabbit still has 3 bottles of ready-made potion. The potion in the first bottle has a_1 mg/ml of USAO and b_1 mg/ml of Camellia. The potion in the second bottle has a_2 mg/ml of USAO and b_2 mg/ml of Camellia. The potion in the third bottle has a_3 mg/ml of USAO and b_3 mg/ml of Camellia. We can assume that there's enough potion in the bottles.

Little Rabbit wants to know whether he can make a kind of potion that has x mg/ml of USAO and y mg/ml of Camellia with the help of the 3 bottles of ready-made potion.

输入描述:

The first line of the input contains two integers a_1 and b_1 (), indicating that the potion in the first bottle has a_1 mg/ml of USAO and b_1 mg/ml of Camellia.

The second line of the input contains two integers a_2 and b_2 (), indicating that the potion in the second bottle has a_2 mg/ml of USAO and b_2 mg/ml of Camellia.

The third line of the input contains two integers a_3 and b_3 (), indicating that the potion in the third bottle has a_3 mg/ml of USAO and b_3 mg/ml of Camellia.

The fourth line contains an integer n (), indicating the number of Little Rabbit's queries.

In the next n lines, each line contains two integers x and y (), indicating that Little Rabbit wants to know whether he can make a kind of potion that has x mg/ml of USAO and y mg/ml of Camellia.

输出描述:

For each query, if Little Rabbit is able to make the potion, output YES in a single line, otherwise output NO in a single line.
示例1

输入

复制
1 1
3 1
2 3
4
2 1
0 0
2 2
3 3

输出

复制
YES
NO
YES
NO

说明

For the sample input, when x=2 and y=1, Little Rabbit can use 10 ml of the potion in the first bottle and 10 ml of the potion in the second bottle. Then there is 10\times1+10\times3=40 mg of USAO and 10\times1+10\times1=20 mg of Camellia. The total volume of the liquid is 10+10=20 ml. As a result, the potion has 40/20=2 mg/ml of USAO and 20/20=1 mg/ml of Camellia, which meets the requirement. So the answer is YES.
When x=0 and y=0, Little Rabbit needs to make pure water with the help of the ready-made potion, which is obviously impossible. So the answer is NO.