solution for the third test