In the first test case, corner $1$ has one of $3$ colors. Corner $2$ has one of the remaining $2$ colors. Corner $3$ has the remaining color, and corner $4$ has the same color as corner $2$. Thus, there are $6$ ways in total. 

In the second test case, we have an odd number of corners and two colors, and every pair of consecutive corners must have different colors; that is impossible.