Little Artem and Dance

Little Artem is fond of dancing. Most of all dances Artem likes rueda — Cuban dance that is danced by pairs of boys and girls forming a circle and dancing together.

More detailed, there are n pairs of boys and girls standing in a circle. Initially, boy number 1 dances with a girl number 1, boy number 2 dances with a girl number 2 and so on. Girls are numbered in the clockwise order. During the dance different moves are announced and all pairs perform this moves. While performing moves boys move along the circle, while girls always stay at their initial position. For the purpose of this problem we consider two different types of moves:

  1. Value x and some direction are announced, and all boys move x positions in the corresponding direction.
  2. Boys dancing with even-indexed girls swap positions with boys who are dancing with odd-indexed girls. That is the one who was dancing with the girl 1 swaps with the one who was dancing with the girl number 2, while the one who was dancing with girl number 3 swaps with the one who was dancing with the girl number 4 and so one. It’s guaranteed that n is even.

Your task is to determine the final position of each boy.

Input

The first line of the input contains two integers n and q (2 ≤ n ≤ 1 000 000, 1 ≤ q ≤ 2 000 000) — the number of couples in the rueda and the number of commands to perform, respectively. It’s guaranteed that n is even.

Next q lines contain the descriptions of the commands. Each command has type as the integer 1 or 2 first. Command of the first type is given as x ( - n ≤ x ≤ n), where 0 ≤ x ≤ n means all boys moves x girls in clockwise direction, while  - x means all boys move x positions in counter-clockwise direction. There is no other input for commands of the second type.

Output

Output n integers, the i-th of them should be equal to the index of boy the i-th girl is dancing with after performing all q moves.

Examples

input

6 3
1 2
2
1 2

output

4 3 6 5 2 1

input

2 3
1 1
2
1 -2

output

1 2

input

4 2
2
1 3

output

1 4 3 2

Solution:

#include<stdio.h>
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<memory.h>
#include

<map>
#include<set>
#include<queue>
#include 	<list>
#include<sstream>
#include<cstring>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define SS stringstream
#define sqr(x) ((x)*(x))
#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define CC(x) cout << (x) << endl
#define pw(x) (1ll<<(x))
#define buli(x) __builtin_popcountll(x)
#define forn(i, n) for(int i = 0 ; (i) < (n) ; ++i)
#define M 1000000007
#define N 211111

#define TASK "1"

using namespace std;
typedef pair<int,int> pt;

int n, q;
int st[2];

int ans[2000222];

int main(){
#ifdef home
freopen(TASK".in","r",stdin);
freopen(TASK".out","w",stdout);
#endif
cin >> n >> q;

vector<int> a[2];

for (int i = 0; i < n; i++) a[i & 1].pb(i);

	st[0] = st[1] = 0;

	int x = 0;
	int y = 1;

	for (int i = 0; i < q; i++) {
		int type;
		scanf("%d", &type);
		if (type == 2) {
			swap(x, y);
		} else {
			int t;
			scanf("%d", &t);
			t = -t;

			t = (t + n) % n;

			if (t == 0) continue;
			st[x] = (st[x] + (t + 1) / 2) % (n / 2);
			st[y] = (st[y] + (t) / 2) % (n / 2);
			if (t % 2) swap(x, y);
		}
	}
	vector<int> p;
for (int i = 0; i < n / 2; i++) {
		p.pb(a[x][(st[x] + i) % (n / 2)]);
		p.pb(a[y][(st[y] + i) % (n / 2)]);
	}
//	for (int i = 0; i < n; i++) cout << p[i] << " ";
//	cout << endl;
//	for (int i = 0; i < n; i++) ans[p[i]] = i;
	for (int i = 0; i < n; i++) ans[i] = p[i];

	for (int i = 0; i < n; i++) {
		printf("%d", ans[i] + 1);
		if (i + 1 == n) puts(""); else putchar(' ');
	}

	return 0;
}