https://factoriobin.com/post/x4l8wj
Put the item you want to build in the constant combinator; The 5 assemblers below be set to the recipe for each quality level of the item.
By default each level will buffer 4-5 stacks of a item at a quality level, if the next level up isn’t full, start to drop items onto the belt for recycling. (We get to 4 stacks, when we are over 4 stacks, if we need to grind for quality, we will). If the higher level quality exists and is 4 stacks, we wont grind.
Request 5x the ingredients into the requestor chest for each assembler.
No quality modules on the legendary assembler.
Using buffers for the output to pull in any items from the network, including quality upgrades from different production quality levels (the legendary output on the epic production line will move to the legendary buffer)