The memory of granular materials