Check if two nodes are cousins