The heroes and villains of The Lord of the Rings are some of the most intelligent beings on Middle-earth. But how do they compare?