The head researcher, Professor Fish, loves efficiency.
However, he keeps changing his mind — sometimes he wants only odd numbers, sometimes squared ones.
You, the junior assistant, must make sure his number stream always comes out exactly how he wants.

Your task is to implement a simple math stream processor that applies a sequence of mathematical transformations to numbers.
A transformation is represented by a generator that takes numbers and yields processed results (for example, doubling, squaring, or filtering even numbers).
You will compose and process these transformations dynamically based on commands.
Help Professor Fish build and maintain a stream of transformations, and then apply them to an input sequence.
Available operations:
add transformation_name Add a new transformation to the end of the streamremove transofrmation_name Remove the first occurrence of the transformationprocess n Process the numbers from 1 to n (inclusive) through the current transformation and print the result Note: If there are multiple process n operations, do not overwrite the result — the original list of numbers should be preserved.
Possible Transformations:
double Multiply each number by 2square Square each numbereven Yield only even numbersodd Yield only odd numbersThese are the ONLY possible transformations.
you may start with the given code:
m operations2 <= m <= 1001 <= n <= 1000 transformation every input process n operation every inputprocess n operation in a single inputEach time you see a process n command, output the resulting stream values one per line.
Explanation for the sample input:
add odd
add double → ops = [odd_gen, double_gen]
process 1–5 → [1, 2, 3, 4, 5]
odd_gen → [1, 3, 5]
double_gen → [2, 6, 10]
prints: 2 6 10
remove odd → ops = [double_gen]
process 1–5:
double_gen → [2, 4, 6, 8, 10]
prints: 2 4 6 8 10
Final printed result: