Under construction

Still being built. Things may change

Oil Pipeline I

Time limit2sMemory limit1024 MB

Summary
Each type 2 event adds C to every plant whose pipeline passes station I, and the task lists the plants that start running.
Level

Medium6 of 10

Topics
Segment tree, Implementation
Solved
No attempts yet

Problem

A new industrial complex keeps adding power plants. The complex has NN fuel stations numbered 1 to NN in a row, and each plant receives its fuel through these stations.

Two kinds of events occur.

  • 11 LL TT: A new power plant enters the complex. It runs only after it receives at least TT units of fuel. A pipeline is installed along stations 1 through LL. If PP plants entered before this one, the new plant is numbered P+1P+1.
  • 22 II CC: Every plant with a pipeline that passes station II receives CC units of fuel. If any plant starts running because of this event, print the count and the numbers of those plants. Plants that were already running before this event are not printed.

Input

The first line contains NN and QQ, the number of stations and the number of events (1≤N≤1000001 \le N \le 100000, 1≤Q≤2000001 \le Q \le 200000). Each of the next QQ lines describes one event.

Let lastlast be the number of plants that started running at the most recent type 2 event. A type 1 event is given as 11 xx TT, and L=x⊕lastL = x \oplus last. A type 2 event is given as 22 yy CC, and I=y⊕lastI = y \oplus last. (1≤L≤N1 \le L \le N, 1≤I≤N1 \le I \le N, 1≤T≤5000001 \le T \le 500000, 1≤C≤5000001 \le C \le 500000)

The generated values of LL and II are guaranteed to stay within range. The value of lastlast is 0 until the first type 2 event is processed.

Output

For each type 2 event, print one line. The line starts with the number of plants that started running, followed by their numbers in ascending order.

Examples1

  1. Example 1

    Input
    13 7
    1 3 5
    2 2 3
    1 12 6
    2 11 5
    2 1 4
    1 6 5
    2 3 5
    
    Expected output
    0
    0
    2 1 2
    1 3