Given an undirected tree with $n$ vertices. Each vertex $v$ has a non-negative integer $a_v$ recorded ($0 \leq a_v < 2^k$).

A set of vertices is called good if the bitwise OR of the values $a$ of the vertices in this set equals $2^k - 1$.

The cost of a set is defined as the maximum of the pairwise distances between the vertices in the set, where the distance between vertices is the number of edges on the unique simple path between them.

You need to find the minimum cost of a good set or state that such a set does not exist.