Shells and subshells are filled in energy level order, so electrons will fill the 2p subshell before the 3s shell.
And the x subshell before the y and z.