URI Online Judge | 1740
# Is it Ordered?

**Timelimit: 4**

By Paulo Cezar Pereira Costa Brazil

Chavaska likes to play with integer sequences. He has a sequence A consisting of N integers that he modifies and analyzes. Particularly he is interested in the ordering of some contiguous subsequences.

He explained to Kabralouco how he is having fun and invited him to play. Kabralouco wants to play but as he can’t think as fast as Chavaska and doesn’t like to stay behind, he decided to cheat and now asks your help creating a program capable of quickly dealing with the following operations:

- 0 X Y – Swap the elements at positions X and Y.
- 1 X Y – Change the value of element at position X to Y.
- 2 X Y – Insert element Y at position X.
- 3 X – Remove element at position X.
- 4 X Y – Query the ordering of the elements on (the subsequence) A[X...Y] and the answers must be:
- “ALL EQUAL” – If A[i] = A[i+1] for all i in [X,Y −1]
- “NON DECREASING” – If A[i] ≤ A[i+1] for all i in [X,Y−1] and A[i] ≠ A[i+1] for some i in [X,Y−1]
- “NONINCREASING” – If A[i] ≥ A[i+1] for all i in [X,Y−1] and A[i] ≠ A[i+1] for some i in [X,Y−1]
- “NONE” – If none of the above orderings happens.

There might be several test cases. The first line of each test case begins with an integer 1 ≤ **N** ≤ 10^{4}, the amount of numbers on the initial sequence. On the next line there are **N** integers |A[i]| ≤ 10^{9} (1 ≤ i ≤ **N**). The next line contains an integer 1 ≤ **Q** ≤ 10^{5}, the number of operations that must be executed. The following **Q** lines are the operations.

Your program should output one line for each query (“4 X Y”), answering whether the subsequence A[X...Y] is NON INCREASING, NON DECREASING, ALL EQUAL or NONE as explained above.

Sample Input | Sample Output |

8 |
NON DECREASING NON INCREASING NONE NON DECREASING ALL EQUAL NONE NON DECREASING |