Separate input and output ports by color