Polarization-encoded all-optical quaternary universal inverter and design of multivalued flip-flop