Back
Close
  • 29

Statement

 Goal

Your program has to indicate whether it is possible to make a single path with a series of dominoes.

Dominoes can be reversed and reordered as needed.
Input
Line 1: The number N of dominoes.
N next lines: Two integers A and B corresponding to the values of a domino.
Output
true if it is possible to make a single path with the dominoes.
false otherwise.
Constraints
2 ≤ N ≤ 20
0 ≤ A,B ≤ 6
Example
Input
2
1 2
2 3
Output
true
Solve it

A higher resolution is required to access the IDE

codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants