Theysayhewasverylearned,agreatfavoritewithprincesandprincesses,andwaspresentatalltheirfestivals.

Please segment the words.
They say he was very learned, a great favorite with princes and princesses, and was present at all their festivals.