1148 合金制造问题


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

假设你有一些金—银的合金,它们的含金量和含银量各不相同,现在要求你通过按某种比例混合,制造出新的合金。

Input

第一个数据T(3=<T<=100)表示有几种合金,接下的T行表示合金的含金,银的比例 X,Y,用空格分开。然后是一个N(N<=500),表示 接下去是N个新的合金的金银比例 X,Y。判断它们能否被制造出来,能的输出"YES",否则输出"NO".X,Y不一定是整数,不一定大于0。

Output

每行包含一个"YES"或者"NO"。

Sample

Input

6
0 0
1 2
1 1
2 2
1 3
0 2
3
1 2
-1  -1
0 0

Output

YES
NO
YES

Comments

There are no comments at the moment.