Assume that the ball denoted by 1 is red. If the ball denoted by 2 is also red, then 1+2=3, 1+3=4, …, 1+11=12 are also red. So in this case all balls are red.
If the ball denoted by 2 is green, we have to consider two more cases. If the ball number 3 is red, then 1+3=4, 1+4=5, …, 1+11=12 are also red. If the ball number 3 is green, then 2+3=5 is also green. Since 1+4=5, 5 is green and 1 is red, the ball denoted by 4 cannot be red and must therefore be green. Then 4+2=6, 5+2=7, 6+2=8, …, 9+2=11, 10+2=12 are also green.
There were three possible cases. If we exchange red and green in the arguments above, we get three more cases. There are 6 cases altogether, namely: all balls are red, all balls are green, all balls but number 1 are green, all balls but number 1 are red, all balls but number 2 are red or all balls but number 2 are green.