Function to solve all the queries
def solve ( n , q ) : NEW_LINE INDENT global a , seg_tree , query NEW_LINE qu = [ 5 , 3 , 6 ] NEW_LINE seg_tree = [ 0 ] * ( 4 * n + 1 ) NEW_LINE build_tree ( 1 , 0 , n - 1 ) NEW_LINE for i in range ( len ( qu ) ) : NEW_LINE INDENT print ( qu [ i ] ) NEW_LINE DEDENT for i in range ( q , q ) : NEW_LINE DEDENT