simple

Time limit: 0.7s Memory limit: 256MB Input: Output:

You are given a sequence of NN numbers and QQ queries:

  • 0 a b val: the number valval will be added to all of the numbers from the interval [a,b][a,b]
  • 1 a b: you need to print the minimum even number and the maximum odd number from the interval [a,b][a,b]; if one of these numbers does not exist, 1-1 will be printed in its place

Task

Answer all of the type 1 queries.

Input data

The first line contains one integer NN. The second line contains NN integers, representing the numbers from the sequence. The third line contains one integer QQ, and the following QQ lines contain QQ queries, as described in the statement.

Output data

The output contains the answers to all of the type 1 queries, one per line.

Constraints and clarifications

  • N,Q200 000N, Q \leq 200 \ 000
  • The numbers from the sequence are between 11 and 2 000 000 0002 \ 000 \ 000 \ 000.
  • The numbers valval from type 0 queries are between 11 and 2 000 000 0002 \ 000 \ 000 \ 000.
  • WARNING! If one of the answers to a type 1 query cannot be calculated, 1-1 will be printed in its place!
# Points Constraints
1 30 N,Q5 000N, Q \leq 5 \ 000
2 30 There are no type 0 queries.
3 40 No additional constraints

Example

stdin

7
5 6 3 1 9 8 5
10
1 2 5
0 2 3 2
1 2 4
0 2 7 3
1 2 4
1 4 7
0 5 7 1
1 1 6
1 1 2
1 3 4

stdout

6 9
8 5
4 11
4 11
4 13
-1 11
4 -1

Explanation

The initial sequence is: 5 6 3 1 9 8 55 \ 6 \ 3 \ 1 \ 9 \ 8 \ 5.

Query 1 2 5: You will print the specified two numbers from the interval [2,5][2, 5].

Query 0 2 3 2: The new sequence is 5 8 5 1 9 8 55 \ 8 \ 5 \ 1 \ 9 \ 8 \ 5.

Query 1 2 4: You will print the specified two numbers from the interval [2,4][2, 4].

Query 0 2 7 3: The new sequence is 5 11 8 4 12 11 85 \ 11 \ 8 \ 4 \ 12 \ 11 \ 8.

Query 1 2 4: You will print the specified two numbers from the interval [2,4][2, 4].

Query 1 4 7: You will print the specified two numbers from the interval [4,7][4, 7].

Query 0 5 7 1: The new sequence is 5 11 8 4 13 11 85 \ 11 \ 8 \ 4 \ 13 \ 11 \ 8.

Query 1 1 6: You will print the specified two numbers from the interval [1,6][1, 6].

Query 1 1 2: You will print the specified two numbers from the interval [1,2][1, 2].

Query 1 3 4: You will print the specified two numbers from the interval [3,4][3, 4].

Log in or sign up to be able to send submissions!