Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register
Language:
Tomorrow Genius 2008
Time Limit: 5000MSMemory Limit: 65536K
Total Submissions: 64Accepted: 16

Description

Tomorrow Genius Contest is a traditional event of Daisy Hill Primary School for the purpose of promoting the spirit of its motto, "Mens et Manus" among the students. This year's rules are quite simple: Given N triangles, the contestants are asked to piece them together to make a rectangle with width W and height H as rapidly and possible. The contestants are allowed to move, rotate but not turn over the triangles. The first one who achieves the goal is the winner of the contest.

Of course the host doesn't want to hold a no-winner contest. So he asks you, the technology support of the contest, to determine whether a problem is solvable.

Input

The first line contains three integers, N (1 ≤ N ≤ 10), W (1 ≤ W ≤ 10), H (1 ≤ H ≤ 10).
The following N lines contain six integers x1, y1, x2, y2, x3, y3 (-100 ≤ xi, yi ≤ 100) each, describing the coordinates of the vertices of a triangle each.

Output

One line contains "YES" or "NO" indicating whether the problem is solvable.

Sample Input

Sample Input 1

6 5 5
0 0 0 3 4 0
0 0 0 3 4 0
0 0 0 3 4 0
0 0 0 3 4 0
0 0 0 1 1 0
0 0 0 1 1 0

Sample Input 2

5 5 5
0 0 0 3 4 0
0 0 0 3 4 0
0 0 0 3 4 0
0 0 0 3 4 0
0 0 0 1 2 0
   

Sample Output

Sample Output 1

YES

Sample Output 2

NO

Source

[Submit]   [Go Back]   [Status]   [Discuss]

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator