I have used two input and gate instead of three input. Because three input and gate is not simulated.