{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n After their royal wedding, LJP and YGY hid away in XX Village, to enjoy their ordinary happy life. People in XX Village lived in beautiful huts. There are some pairs of huts connected by bidirectional roads. We say that huts in the same pair directly connected. XX Village is so special that we can reach any other huts starting from an arbitrary hut. If each road cannot be walked along twice, then the route between every pair is unique. \n \u003cbr\u003e \n \u003cbr\u003eSince LJP earned enough money, YGY became a housewife. Their children loved to go to other kids, then make a simple call to YGY: \u0027Mummy, take me home!\u0027 \n \u003cbr\u003e \n \u003cbr\u003eAt different times, the time needed to walk along a road may be different. For example, YGY takes 5 minutes on a road normally, but may take 10 minutes if there is a lovely little dog to play with, or take 3 minutes if there is some unknown strange smell surrounding the road. \n \u003cbr\u003e \n \u003cbr\u003eYGY loves her children, so she would like to tell her children the exact time she will spend on the roads. Can you help her? \n \u003cbr\u003e\n \u003c/div\u003e"}},{"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 YGY 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 YGY. 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 YGY is on her way. The changed can only happen when YGY 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"}}]}