{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"给定一棵含n个结点的树,共有q次操作,分为两种\n\n0 c :求从位置s到c的距离,然后s变成c\n\n1 a b:把第a条边的权值变为b"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n The first line contains three integers n, q, s. There are n huts in XX Village, q messages to process, and Wind is currently in hut s. n \u0026lt; 100001 , q \u0026lt; 100001. \n \u003cbr\u003e \n \u003cbr\u003eThe following n-1 lines each contains three integers a, b and w. That means there is a road directly connecting hut a and b, time required is w. 1\u0026lt;\u003dw\u0026lt;\u003d 10000. \n \u003cbr\u003e \n \u003cbr\u003eThe following q lines each is one of the following two types: \n \u003cbr\u003e \n \u003cbr\u003eMessage A: 0 u \n \u003cbr\u003e A kid in hut u calls Wind. She should go to hut u from her current position. \n \u003cbr\u003eMessage B: 1 i w \n \u003cbr\u003e The time required for i-th road is changed to w. Note that the time change will not happen when Wind is on her way. The changed can only happen when Wind is staying somewhere, waiting to take the next kid. \n \u003cbr\u003e\n \u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n For each message A, print an integer X, the time required to take the next child.\n \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e3 3 1\n1 2 1\n2 3 2\n0 2\n1 2 3\n0 3\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e1\n3\n\u003c/pre\u003e"}}]}