Factorize query conditions

x0 | x1 & y0 | x2 & y0 &y1 | x3 & y0 & y1 & y2 ...
<=>
x0 | y0 &
     (x1 | y1 &
          (x2 | y2 &
               (x3 | y3 & ... )))