Bruteforce approach for this problem is going through all possible pairs of cows and check if the cows share a common flavor. But it takes $O(N^2)$ to