You are given a network of nodes and connections between them (so called edges). A path in this newtork is defined as an interchanging sequence of nodes and connecting edges: n_0, E_0, n_1, ..., E_k-1, n_k (starting and ending at a node) in which nodes may not repeat. The length of a path is the number of edges on it. Your task is to find the longest possible path in the given network. Note that the network contains no isolated components, meaning, there is a path connecting any two nodes.
The newtork is defined as follows. Each line describes one edge via its endpoints with 2 dash characters between, e.g., nodeone -- nodetwo. Node identifiers are strings consisting of lowercase letters only.
Input format
Each line in the input defines an edge in the network, using the format nodeone -- nodetwo.
Output format
The length of a longest possible path in the network.
Sample input
a -- b
a -- c
a -- d
e -- a
f -- e
g -- f
Sample output
4