Logic Synthesis with AND and OR Gates in Multi-levels