Early humans knew how to make comfy, pest-free beds, study says