If y varies directly as x and inversely as z^2, and y=3 when x=2 and z=4, what is the value of x when y=9 and z=4?