Set the left and right pointers to extreme
left = n NEW_LINE right = 0 NEW_LINE mx = 0 NEW_LINE queries = [ Query ( ) for _ in range ( 4 * n ) ] NEW_LINE j = 0 NEW_LINE for i in range ( n - 1 , - 1 , - 1 ) : NEW_LINE