SOLVE

LATER

Childhood Games

Problem

Editorial

Analytics

Sunny loves playing childhood games even he is professional. Today he remembers a game in which we have to draw a shape without lifting our pencil. The description of shape that he has is a series of curved non-overlapping lines. You have to just print **YES** in case its possible to draw the shape without lifting pencil or else print **NO**.

**YOU CAN NOT TRACE A LINE TWICE**

**Input**

First line contains a number $$N$$ as input which is total number of line segments in the shape.

Each of the next $$N$$ lines contain description of each non overlapping curve in the form $$x_1, y_1, x_2, y_2$$ which means curve connects points $$(x_1,y_1)$$ and $$(x_2,y_2)$$
in the x-y plane

**Output**

Output **YES** if the shape can be drawn without lifting the pencil or else print **NO**

**Constraints**

$$1 \le N \le 10^5$$

$$1 \le x_1, y_1, x_2, y_2 \le 10^9$$

Explanation

The shape formed here is depicted in the image and you can make it without lifting pencil if you start from (2,1) -> (1,2) -> (1,1) -> (2,2) - > (2,1) - >(1,1)

Time Limit:
1.0 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
C,
C++,
C++14,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Julia,
Kotlin,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Visual Basic

Initializing Code Editor...

{"30ac67d": "/pagelets/recommended-problems/algorithm/matrix-and-queries/", "2feab9c": "/pagelets/problems-hint/algorithm/matrix-and-queries/", "23e83fe": "/pagelets/problem-author-tester/algorithm/matrix-and-queries/", "fbf0cd0": "/pagelets/suggested-problems/algorithm/matrix-and-queries/", "658bd21": "/pagelets/show-submission/algorithm/matrix-and-queries/"}

realtime.hackerearth.com

80

db1ad2b1f004e4ed56e7b455748df0f8f855f15c

58a29e5cae2309f04b28

/realtime/pusher/auth/