SOLVE

LATER

Micro and Coins

Problem

Editorial

Analytics

Micro was playing with a graph gifted to him by his friend on his birthday. The graph contains $$N$$ vertices and $$M$$ edges. All the edges are bidirectional. On each vertex of the graph there is a coin. Now Micro has to collect them all. But the game has some rules. The player has to start with some vertex. From current vertex, player can visit only those vertices which are connected to it by an edge. Also if a vertex is visited it cannot be visited again. Now Micro wants to find if he'll be able to collect all the coins.

**Input:**

First line consists of an integer $$T$$ denoting the number of test cases.

First line of each test case consists of two space separated integers denoting $$N$$ and $$M$$ and the following $$M$$ lines consists of two space separated integers $$X$$ and $$Y$$ denoting there is an edge between vertices $$X$$ and $$Y$$.

**Output:**

For each test case, if Micro is able to collect all the coins then print "Yes" (without quotes) otherwise print "No" (without quotes).

**Constraints:**

$$ 1 \le T \le 10 $$

$$ 1 \le N \le 10 $$

$$ 0 \le M \le 100 $$

$$ 1 \le X, Y \le N $$

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,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Visual Basic,
Kotlin

Initializing Code Editor...

{"052c591": "/pagelets/problem-author-tester/algorithm/micro-and-coins/", "052c5bc": "/pagelets/recommended-problems/algorithm/micro-and-coins/", "052c57a": "/pagelets/suggested-problems/algorithm/micro-and-coins/", "052c556": "/pagelets/show-submission/algorithm/micro-and-coins/", "052c5a6": "/pagelets/problems-hint/algorithm/micro-and-coins/"}

{}

realtime.hackerearth.com

80

90a98e06481b86ebc6ea6b448555cb3b5136815e

58a29e5cae2309f04b28

/realtime/pusher/auth/