Akku have solved many problems, she is genius. One day her friend gave her an Array and asked her to perform

some queries of following type:

Each query consists of three integers

1 A B : Update the Array at index A by value B

2 A B : if the subarray from index A to B (both inclusive) is

1. Both increasing(Non-decreasing) and decreasing(Non-increasing) print -1

2. Only increasing(Non-decreasing) print 0

3. Only decreasing(Non-increasing) print 1

4. Neither increasing nor decreasing print -1

Akku needs your help, can you help her.

**Input:**

The first line of input constists of the integer T, indicating the number of test cases.The first line of each

test case constists of the number N, indicating the number of elements in the array,A. Next line consists of N space

seperated integers indicating the array. Next line consists of an integer Q , denoting the

number of queries. Next Q lines consists of three integers X,A,B

**Output:**

For each test case query of type 2, the output is an integer indicating the required Answer in newline.

**Constraints:**

1 <= T <= 5

1 <= N <= 100000

1 <= A[i] <= 100000

1 <= Q <= 100000

**Example:
Input:**

1

7

1 5 7 4 3 5 2

5

2 1 3

2 2 4

2 3 4

1 6 3

2 5 6

0

-1

1

-1

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

Sulagna | 117 |

RUTVIKHARIPARA | 116 |

janvidavda105190 | 93 |

harshsiddhapura105461 | 93 |

devsinghindra | 80 |

PiyushPandey4 | 614 |

ASWATHAMA | 561 |

akhyasharma01 | 547 |

john_wick | 521 |

jagrit_07 | 443 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4598 |

Login to report an issue on this page.