CF593D Happy Tree Party

Description

Bogdan has a birthday today and mom gave him a tree consisting of $ n $ vertecies. For every edge of the tree $ i $ , some number $ x_{i} $ was written on it. In case you forget, a tree is a connected non-directed graph without cycles. After the present was granted, $ m $ guests consecutively come to Bogdan's party. When the $ i $ -th guest comes, he performs exactly one of the two possible operations: 1. Chooses some number $ y_{i} $ , and two vertecies $ a_{i} $ and $ b_{i} $ . After that, he moves along the edges of the tree from vertex $ a_{i} $ to vertex $ b_{i} $ using the shortest path (of course, such a path is unique in the tree). Every time he moves along some edge $ j $ , he replaces his current number $ y_{i} $ by ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF593D/e8720135a5811c36c19a70c9d7c8e555f243509b.png), that is, by the result of integer division $ y_{i} $ div $ x_{j} $ . 2. Chooses some edge $ p_{i} $ and replaces the value written in it $ x_{p_i} $ by some positive integer $ c_{i} < x_{p_i} $ . As Bogdan cares about his guests, he decided to ease the process. Write a program that performs all the operations requested by guests and outputs the resulting value $ y_{i} $ for each $ i $ of the first type.

Input Format

The first line of the input contains integers, $ n $ and $ m $ ( $ 2\le n\le 200000 $ , $ 1\le m\le 200000 $ ) — the number of vertecies in the tree granted to Bogdan by his mom and the number of guests that came to the party respectively. Next $ n-1 $ lines contain the description of the edges. The $ i $ -th of these lines contains three integers $ u_{i} $ , $ v_{i} $ and $ x_{i} $ ( $ 1\le u_{i},v_{i}\le n $ , $ u_{i}≠v_{i} $ , $ 1\le x_{i}\le 10^{18} $ ), denoting an edge that connects vertecies $ u_{i} $ and $ v_{i} $ , with the number $ x_{i} $ initially written on it. The following $ m $ lines describe operations, requested by Bogdan's guests. Each description contains three or four integers and has one of the two possible forms: - $ 1 $ $ a_{i} $ $ b_{i} $ $ y_{i} $ corresponds to a guest, who chooses the operation of the first type. - $ 2 $ $ p_{i} $ $ c_{i} $ corresponds to a guests, who chooses the operation of the second type. It is guaranteed that all the queries are correct, namely $ 1\le a_{i},b_{i}\le n $ , $ 1\le p_{i}\le n-1 $ , $ 1\le y_{i}\le 10^{18} $ and $ 1\le c_{i} < x_{p_i} $ , where $ x_{p_i} $ represents a number written on edge $ p_{i} $ at this particular moment of time that is not necessarily equal to the initial value $ x_{p_i} $ , as some decreases may have already been applied to it. The edges are numbered from $ 1 $ to $ n-1 $ in the order they appear in the input.

Output Format

For each guest who chooses the operation of the first type, print the result of processing the value $ y_{i} $ through the path from $ a_{i} $ to $ b_{i} $ .

Explanation/Hint

Initially the tree looks like this: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF593D/8f4609ac7a27dc1cf96a5917728a388ad53ca5e7.png)The response to the first query is: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF593D/da6f4be98e49212f98fbce9d68ea2af427cf9a5a.png) = 2 After the third edge is changed, the tree looks like this: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF593D/8377b4398e15d74100ef5209d243851d1a1f9dbe.png)The response to the second query is: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF593D/4fc4a6e7a450b9f41c56fce77f7f6f0d5a519fb1.png) = 4 In the third query the initial and final vertex coincide, that is, the answer will be the initial number 20. After the change in the fourth edge the tree looks like this: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF593D/e5c9538174a68ac225ce8eb24a73e0ec9f7f15a0.png)In the last query the answer will be: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF593D/8206ab32d6ec1efd7804b29ac88f8d199925a782.png) = 3