# Picking out elements from a multi-level list

I have the following problem that is giving me headaches: I have a list with the elements in the following form:

{x,{{a1,b1},{a2,b2},{a3,b3}}}


I would like to select all the elements in this list that satisfy the following rules simultaneously:

1. x<0
2. ai x bi <0, where i is 1,2 or 3

I tried to use Select but I am having trouble getting it to apply the second condition.

Generating some toy data and testing:

ab = RandomInteger[{-10, 10}, {10, 3, 2}];
xs = RandomInteger[{-10, 10}, 10]; • Sorry but maybe I didn't explain it properly: the result I am looking for is: if a2 x b2 <0 then the result of Select should be {x,{a2,b2}}. Does it make sense? Nov 8, 2019 at 11:31
• your toy data is exactly like my data. What I need to do is turn the list with elements in the form {x,{{a1,b1},{a2,b2},{a3,b3}} into a list (it can be smaller than the original list!) with elements {x,{a,b}} where the pair {a,b} is one of the three pairs in the original list such that a b<0 Nov 8, 2019 at 11:40