SOLVE

LATER

Chessboard and Dominoes

Problem

Editorial

Analytics

There is a 8x8 chessboard in which two positions are cut-off (i.e not available for placing any piece). You are given 31 dominos , and a single domino can cover exactly two squares. Given the two positions which are cut-off , find if it is possible to cover the entire board with 31 exactly dominos so that no vacant square exists.

Here is the view of chess board with rows from 1-8 and columns from A-H.

**Input**

The first line of input contains **T** , the number of test cases.

The first line of each testcase contains **X** and **Y** , where CHESS[X][Y] is cutoff.

The second line of each testcase contains **A** and **B** , where CHESS[A][B] is cutoff.

**OUTPUT**

For each testcase , output "YES" if possible else "NO" on a new line.

Explanation

For the first test case , the cut-off squares are CHESS[5][E] and CHESS[5][D] which are shown as red squares in the picture below.

31 dominos are placed without any extra space left , so we output "YES".

Time Limit:
1.25 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,
Swift-4.1,
Visual Basic

Initializing Code Editor...

{"1d96706": "/pagelets/suggested-problems/algorithm/chessboard-and-dominos-3/", "7eb84bd": "/pagelets/recommended-problems/algorithm/chessboard-and-dominos-3/", "0805d14": "/pagelets/problem-author-tester/algorithm/chessboard-and-dominos-3/", "76fcb6c": "/pagelets/show-submission/algorithm/chessboard-and-dominos-3/", "e780d7a": "/pagelets/problems-hint/algorithm/chessboard-and-dominos-3/"}

realtime.hackerearth.com

80

8440dd51fd3f0ff0aecb2e06a6a7e518fa40b785

58a29e5cae2309f04b28

/realtime/pusher/auth/