How does your brain manage to see both the trees and the forest? A new study suggests that getting the big picture requires some downtime and, for an extra boost, a night of sleep.

The ability to recognize hidden relations among our memories, a characteristically human feature, is vital for solving problems in creative ways. To understand how this “relational memory” develops, a team of researchers from Harvard Medical School and McGill University presented students with pairs of abstract images in which one image was considered “greater” (graphic above), then asked them to guess the hierarchy of the images in new combinations.

Subjects tested 20 minutes after the learning period performed no better than chance—their brains had not yet been able to figure out new connections. Those who were tested after at least 12 hours, however, were much more successful in detecting the hidden relations. And participants who had slept during their time away from testing outperformed the other groups in the most difficult inferences.

“The process of binding memories together evolves over time,” says neurologist Jeffrey Ellenbogen, a member of the research team. As we sleep or focus on other tasks, our brain forges connections in the background, fitting newly learned information into a bigger picture. One more reason why you should sleep before taking an exam: connecting the dots takes time.