Quantum heat engine with multilevel quantum systems