Scaled conductance quantization unravels the switching mechanism in organic ternary resistive memories