0 red 5 yellow
1 red 4 yellow
2 red and 3 yellow
3 red and 2 yellow
4 red 1 yellow
5 red 0 yellow
Looking at the above, we can see that in any case, at least three balls are the same color.
Actually, we can think so. First, touch four, two red and two yellow. No matter how you touch it, if it is not red and yellow, there are already three colors. If you touch 1, there must be three colors.