A graph which has nodes from 1 to N and there exist an edge between two nodes if Bitwise AND of those two nodes is not zero, is called AND Graph.
You are given Q queries. Each query contains N - no of nodes and two nodes A and B. For each query you have to tell minimum distance between A and B. If there doesn't exist a path between the nodes A and B, then print -1.
Input Format
Output Format
Constraints