# Claw Decomposition

A claw is defined as a pointed curved nail on the end of each toe in birds, some reptiles, and some mammals. However, if you are a graph theory enthusiast, you may understand the following special class of graph as shown in the following figure by the word claw. If you are more concerned about graph theory terminology, you may want to define claw as K1,3. Lets leave the definition for the moment and come to the problem. You are given a simple undirected graph in which every vertex has degree 3. You are to figure out whether the graph can be decomposed into claws or not. Just for the sake of clarity, a decomposition of a graph is a list of subgraphs such that each edge appears in exactly one subgraph in the list. Input There will be several cases in the input file. Each case starts with the number of vertices in the graph, V (4 ≤ V ≤ 300). This is followed by a list of edges. Every line in the list has two integers, a and b, the endpoints of an edge (1 ≤ a,b ≤ V). The edge list ends with a line with a pair of ‘0’. The end of input is denoted by a case with V = 0. This case should not be processed. Output For every case in the input, print ‘YES’ if the graph can be decomposed into claws and ‘NO’ otherwise. Sample Input 4 12 13 14 23 24 34 00 6 12 13 16 23 25 34 45 46 56 00 0

2/2 Sample Output NO NO