You have a dynamic graph on $$$n$$$ vertices. The graph is described by an array $$$a$$$: vertex $$$i$$$ has an edge to $$$a_i$$$. Initially, $$$a_i=i$$$ for all $$$i$$$.
You are given $$$q$$$ triples ($$$u$$$,$$$x$$$,$$$s$$$). For each of them, do the following:
The first line contains two integers $$$n$$$ and $$$q$$$ ($$$1 \le n,q \le 2\cdot 10^5$$$) — the number of vertices and the number of queries, respectively.
Each of the following $$$q$$$ lines contains three integers $$$u,x,s$$$ ($$$1 \le u,x,s \le n$$$) — parameters of a query.
For each query, output a single integer — the number of steps of the walk.
8 71 2 22 3 13 1 11 7 17 2 15 3 56 2 6
1 3 3 2 4 5 5