A magical frog is trying to cross a pond by jumping across a straight line of $$$n$$$ giant lily pads, numbered $$$1$$$ to $$$n$$$. Each lily pad along the way has its own unique musical properties. When the frog stands on pad $$$i$$$, it can sing a specific frequency note called a Launch Tune ($$$a_i$$$) to prepare for a giant leap, while the pad itself constantly hums a natural frequency note known as its Echo Frequency ($$$b_i$$$).
The frog starts its journey on lily pad $$$1$$$. From its current pad $$$i$$$, the frog can perform one of three actions. Each action costs exactly $$$1$$$ jump:
Find the minimum number of jumps required for the frog to reach lily pad $$$n$$$. It is mathematically guaranteed that the frog can always reach the end of the pond.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^4$$$) denoting the number of test cases.
For each test case:
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$10^6$$$.
For each test case, output a single integer on a new line: the minimum number of jumps required to reach lily pad $$$n$$$.
210100 50 50 20 99 100 98 100 97 999100 20 30 40 50 100 70 100 90 1031 2 31 1 1
62
For the first test case:
For the second test case, there are no valid matching frequencies between the frog's Launch Tunes and previous Echo Frequencies. The frog must perform action 1 consecutively $$$2$$$ times to reach pad $$$3$$$.
| Name |
|---|


