Memorizing environmental signals through feedback and feedforward loops.