There are two colors. If you touch three balls, you can make sure that the two balls are the same color.
As long as the balls are 1 more than their colors, two balls can be guaranteed to be the same color.
Make sure that the two balls are the same color: number of balls in contact = color type+1.