Administrator Selfridge is analyzing possible mining routes on Pandora. Each map he has collected is given as a graph of mines and the tunnels connecting them. For every graph, determine how many distinct mines (nodes) and how many distinct tunnels (edges) it contains.
The input contains one or more graphs. Each graph starts with a line containing exactly GRAPH BEGIN and finishes with a line containing exactly GRAPH END.
Between those two markers, every line describes one mine followed by the mines adjacent to it, separated by spaces. The first token on a line is the mine itself; each remaining token is a mine directly connected to it by a tunnel.
A mine identifier is a non-empty string that contains no spaces. The same mine may be described on several lines, and some mines appear only as a neighbor, never as the first token of a line. The block of graphs may repeat any number of times, and each graph is analyzed independently from scratch.
Every tunnel is undirected: the connection between mines u and v is the same tunnel whether written as u v or v u, and listing it more than once still counts as a single tunnel. A mine listed as its own neighbor forms a single self-tunnel.
For each graph, in the order given, print a single line:
NODES <n> EDGES <e>
where <n> is the number of distinct mines and <e> is the number of distinct undirected tunnels in that graph. Print NODES and EDGES in uppercase, each separated from its number by a single space.
