F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Business Cards

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1203    Accepted Submission(s): 326


Problem Description
Running a paper shop is not an easy job, especially with harsh customers. Today they brought their own rectangular sheets of paper, asking you to cut it into rectangular business cards of specific size.

Moreover, they require that all the paper (which may not be cheap, but is definitely not that expensive!) has to be used, i.e. no tiny bit may be left over.
Moreover, the brilliant idea of cutting the sheet into very small pieces, and then gluing them together in desired sheets was laughed at.

An example of a 9 *6 paper sheet divided into 2 * 3 cards is given below.

 

Input
The input contains several test cases. The first line contains the number of test cases t (t <= 10^5). Then t test cases follow. Each of them consists of one line containing four integers a, b, c, d (1 <=a, b, c, d <= 10^9).

Numbers a and b are dimensions of each business card; c and d are dimensions of the paper sheet.
 

Output
For each test case output one line containing word YES if it is possible to divide the whole sheet into business cards, and NO otherwise.
 

Sample Input
4 2 3 9 6 2 3 8 6 2 3 6 8 2 3 5 7
 

Sample Output
YES YES YES NO
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 17:03:17, Gzip enabled