Circuit mechanisms underlying memory encoding and retrieval in the long axis of the hippocampal formation