Help me in solving SQLP161 problem

My issue

Why is it not possible to perform union in this case?

Learning course: Analytics case studies
Problem Link: CodeChef: Practical coding for everyone