At the factory, which produces multi-colored balls, the accident occurred: for broken belts, and began to produce absolutely balls of different colors in random order. There can not do without your intervention. Your job is to sort-balls so that one-color balls were from three or more pieces. You can choose any of the three pipelines, which rotate at different speeds. Good luck!