Assigns the appropriate parent tag based on the tags prefix