Finds the smallest and largest items in a list.