Let us take the extreme case. Suppose, you started taking out balls and all balls are of different color. 1st 6 pics will result is 6 balls of different colors.Similarly, keep picking the balls till no white ball is left(since white ball is minimum in number.)Taking the extreme case, you have picked total 6*4=24 balls in which you have 4 balls of each color.
Now, again continue the cycle, taking the worst case that each time you get a ball of different color. Do this till all black balls are over. So, now you will have 5*4=20 balls of which 4 are of same color.
Combining both the steps, now you have 4+4 = 8 balls of all colors, in 24+20=44 pickups
The next pick will give you ball of any color, which will give you 9th ball of any of the colors you have.
Hence, minimum attempt required is = 44+1 = 45 picks.