Rotating the basket order

No attempts yetTime limit1sMemory limit256 MB

Problem

Dohyun has NN baskets, and the baskets are numbered 1 through NN in order. The baskets stand in one row. The leftmost basket is at position 1, the next one at position 2, and so on up to position NN at the right end.

Dohyun rotates the basket order MM times. For each rotation he picks the range to rotate, then picks one basket inside that range as the pivot. If the ends of the chosen range are beginbegin and endend and the pivot sits at position midmid, then the baskets that stood in the order begin,begin+1,,mid1,mid,mid+1,,end1,endbegin, begin+1, \dots, mid-1, mid, mid+1, \dots, end-1, end end up in the order mid,mid+1,,end1,end,begin,begin+1,,mid1mid, mid+1, \dots, end-1, end, begin, begin+1, \dots, mid-1.

Given the rotations, write a program that performs all MM of them and prints the number written on each basket, starting from the leftmost one.

Input

The first line contains NN (1N1001 \le N \le 100) and MM (1M1001 \le M \le 100).

Each of the next MM lines contains one rotation as three integers ii, jj, kk. It means the order of the baskets from position ii to position jj counted from the left is rotated, and the pivot is the basket at position kk. (1ikjN1 \le i \le k \le j \le N)

Dohyun applies the rotations in the order they are given.

Output

After all rotations, print the number written on each basket from the leftmost one, on one line, separated by single spaces.