Magnetic force acting on the charged particle F=qvB sinθ
where θ is the angle between the velocity of particle v and magnetic field B.
So, for maximum force sinθ=1
⟹ θ=90o
Hence, the magnetic field must be in the direction perpendicular to the velocity of particle. So, magnetic field must either be in y- axis or z-axis.