Three-jet production in deep-inelastic electron-proton scattering to order αs2