Before Magellan arrived, the ancient peoples of the Philippine islands lived in separate kingdoms, rajahnates, principalities, confederations and sultanates. These small maritime states flourished from as early as the 1st Millenium, and traded with present-day China, India, Japan, Thailand, Vietnam and Indonesia.