Kera's line segment
题号:NC222898
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

Kera likes line segments. He has  line segments, and each line segment can be described by  and  on the number axis. Moreover, each line segment Kera has its preferred value .

Then there are  operations:

  •  — Add a line segment on the number axis, according to the above.

  •  — Query the maximum difference of preferred values of all line segments that are fully contained by the interval represented by [L, R].

    In addition, a line segment fully contained by the interval means: 

输入描述:

The first line contains two integer  and .

Each of the next  lines contains  integers  ,  and .

Each of the next  lines contains  integers  or  integers .

Specifically, in order to get the real input, you need to create a variable named  with an initial value of 0.

For each operation(op = 1),     .

For each operation(op = 2),     , then  updated to result of this query.

In addition,  means binary exclusive OR.

.

输出描述:

For each operation , print an integer to represent the maximum difference of preferred values.

It is guaranteed that each query fully contains at least one line segment.

示例1

输入

复制
3 5
2 3 1
5 6 4
4 10 5
2 2 5
2 2 6
2 2 9
1 2 3 20
2 5 14

输出

复制
0
3
4
19

说明

The real sample input:

3 5
2 3 1
5 6 4
4 10 5
2 2 5
2 2 6
2 1 10
1 6 7 20
2 1 10