two colors interset with each other

Hi All,
I met some problems about using two colors in a cube. As you can see from the picture, when I rotate the cube, some wave-like edges come out. And the two colors overstep their own region. How should I deal with this?
Thanks!
Best,
Steven