added query on categories pairs