Quantum state engineering by nonlinear quantum interference