Under construction

Still being built. Things may change

Dance on the Circle

Time limit2sMemory limit512 MB

Summary
Simulate N men dancing around a circle of N women through rotation moves and adjacent swaps, then report which man faces each woman at the end.
Level

Easy3 of 10

Topics
Simulation, Implementation, Math
Solved
No attempts yet

Problem

NN men and NN women dance in a circle. NN is even. The women stand still on the inside of the circle and the men move around the outside. The men are numbered 1 to NN clockwise and the women are numbered 1 to NN clockwise. At the start, the man and the woman with the same number face each other. The dance is a sequence of moves, and there are two kinds of move.

  1. An integer xx is given, and every man moves xx places clockwise. If xx is negative, every man moves −x-x places counterclockwise.
  2. The man standing in front of an odd numbered woman trades places with the man standing in front of the next even numbered woman. That is, for every ii with 1≤i≤N/21 \le i \le N/2, the man in front of woman 2i−12i-1 and the man in front of woman 2i2i swap places.

After all QQ moves are performed, report which man faces which woman.

Input

The first line contains NN and QQ. (2≤N≤1000002 \le N \le 100000, 1≤Q≤2000001 \le Q \le 200000, NN is even)

Each of the next QQ lines describes one move, in the order the moves are performed. The first number on a line is the kind of the move. If that number is 1, one integer xx follows on the same line. If it is 2, nothing follows. So every line has the form "1 x" or "2". (−N≤x≤N-N \le x \le N)

Output

Print NN integers on one line, separated by single spaces. The ii-th integer is the number of the man who faces woman ii after the dance ends.

Examples3

  1. Example 1

    Input
    6 3
    1 2
    2
    1 2
    
    Expected output
    4 3 6 5 2 1
    
  2. Example 2

    Input
    2 3
    1 1
    2
    1 -2
    
    Expected output
    1 2
    
  3. Example 3

    Input
    4 2
    2
    1 3
    
    Expected output
    1 4 3 2