We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
  • HackerRank Home
  • |
  • Prepare
  • Certify
  • Compete
  • Apply
  • Hiring developers?
  1. Prepare
  2. Mathematics
  3. Geometry
  4. Jim Beam

Jim Beam

Problem
Submissions
Leaderboard
Discussions
Editorial

Jim likes to play with laser beams.
Jim stays at point .
There is a mirror at point and a wall between points and .

Jim wants to find out if he can point the laser beam on the mirror.

Input Format
First line contains the number of test cases, .
Each subsequent line contains one test case: space separated integers that denote endpoints of the wall , and position of the mirror .

Output Format
The answer for each test case: Display YES if Jim can point the laser beam to the mirror, otherwise display NO .

Constraints


Mirror doesn't have common points with wall.
Wall doesn't pass through the point .

Sample Input

5
1 2 2 1 2 2
-1 1 1 1 1 -1
1 1 2 2 3 3
2 2 3 3 1 1
0 1 1 1 0 2

Sample Output

NO
YES
NO
YES
NO

Author

morze_47

Difficulty

Hard

Max Score

40

Submitted By

737

Need Help?


View discussions
View editorial
View top submissions

rate this challenge

MORE DETAILS

Download problem statement
Download sample test cases
Suggest Edits

Choose a translation


  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Helpdesk
  • Careers
  • Terms Of Service
  • Privacy Policy

Cookie support is required to access HackerRank

Seems like cookies are disabled on this browser, please enable them to open this website

An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com