A function machine is shown below.
Find the output when the input is 18.
Find the input when the output is 6.