#000051

z-magija

Mr. Little Z has found a job as a magician, and his show is as follows: Mr. Little Z has n cards, and they are all facedown. The audience can demand that Mr. Little Z rotate all the cards starting with some card a up to some card b (a <= b). The can repeatedly demand that different sets of cards be rotated. The audience can then demand that Mr. Little Z tell them whether or not the Kth card is facedown. This game wouldn't be very interesting if Mr. Little Z was looking at the cards, but instead Mr. Little Z is actually doing everything in his head!


Because the audience became much more demanding and wanted faster answers, Mr. Little Z decided to get a mini-computer he can carry with himself when he is answering the audience's questions. Help Mr. Little Z write a program for the mini-computer that can help him quickly answer the audience.


InputThe first line of the standard input contains two numbers, n and k. n represents the number of cards, for which Mr. Little Z has to know whether or not they are facedown (n <= 200000). k represents the number of demands the audience makes (k <= 200000). In the next k lines you are given descriptions of the audience's demands, given as follows. If the first number in a line is 1, then that line describes the demand for rotating the cards. After the number 1 you are given two numbers a and b, 1 <= a <= b <= n, which means Mr. Little Z has to rotate all the cards from the ath to the bth positions. If the first number in the line is 2, then behind the number 2 you are given one number m. Mr. Little Z has to answer if the card number m is facedown or not. *You will always have at least one demand of the second type

OutputTo the standard output, for each demand starting with number 2 (demand of the second type) output one line that represents the orientation of the card that the audience has chosen. The orientation of the card can be described as follows: 0 means the card is facedown and 1 means the card is not facedown. *At the beginning all the cards are facedown.

Input:
10 7
1 1 10
2 3
1 5 10
2 5
1 1 5
2 5
2 7

Output:
1
0
1
0

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.