How the brain resolves conflicts between needs across time