Given a BST, and a reference to a Node x the task is to find the Inorder Successor of the node .

**Input:**

The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. The second line consist of an integer N. Then in the next line are N space separated values of the BST nodes. In the next line is an integer x representing the value of the node in the BST.

**Output:**

For each test case output will be the Inorder successor of the given node. If no such successor is present output will be -1.

**Constraints:**

1<=T<=100

1<=N<1100

1<=A[]<=1000

**Example:
Input:**

2

7

20 8 22 4 12 10 14

8

7

20 8 22 4 12 10 14

10

10

12

Ravneet Baansal | 72 |

mhao | 44 |

anime | 33 |

Ibrahim Nash | 29 |

Divyansh Njr | 29 |

tyaglot | 447 |

taobupt | 274 |

bentlynixon | 241 |

Ravneet Baansal | 225 |

thurki | 217 |

akhayrutdinov | 3944 |

sanjay05 | 3366 |

Michael Riegger | 2119 |

Quandray | 2086 |

Jasleen Kaur 2 | 2012 |