Before the arrival of the Spaniards, ancient Filipinos lived in scattered villages ruled by chieftains and had their own distinct culture. They lived in houses made of light materials like wood and bamboo, and some built treehouses for protection. Men wore a jacket and loincloth while women wore a jacket and skirt. Society was organized into independent barangays headed by datus, and they had religious beliefs that included supreme deities and an afterlife. They also had superstitious beliefs in magical creatures. They adorned themselves with gold jewelry and practiced tattooing. Education was acquired through observation and parents taught literacy. They had musical instruments and dances for rituals, festivals, and war.