Horrible Queries

Problem Name:
Horrible Queries
Site:Spoj
Links:
Tags:
Problem setters: