The boxes are each containers of uniquely colored balls. So, to get two balls of the same color, two boxes need to be opened.
or
The boxes are each a container of uniquely colored balls. So, to get two balls of the same color, two boxes need to be opened.
Best Answer
To reduce the confusion, I would edit as follows: "Each of the two boxes contains uniquely colored balls. Thus, to get two balls of the same color, both boxes need to be opened." -or- if there are more than two boxes, you could write: "Each of the boxes contains uniquely colored balls. Thus, to get two balls of the same color, two boxes need to be opened."
Best wishes!