Segment tree

U i x : Set the value of A[i] to x. 
Q x y : Find i and j such that x ≤ i, j ≤ y and i != j, such that the sum A[i]+A[j] is maximized. Print the sum A[i]+A[j].