#include <iostream>

using namespace std;

int main()
{
	int n,m,i,j,c,xx,yy,x,y;
	bool seq[100001];
	cin >> n;
	cin >> m;
	for (i=0; i<=n; ++i) seq[i] = false;
	for (i=0; i<m; ++i)
	{
		cin >> c;
		if (c == 1)
		{
			cin >> x; cin >> y;
			for (j=x; j<=y; ++j) seq[j] = not seq[j];
		}
		else
		{
			cin >> x;
			j=x;
			while ((j>0) and (seq[j]==seq[x])) j--;
			xx = j+1;
			j=x;
			while ((j<=n) and (seq[j]==seq[x])) j++;
			yy = j-1;
			if (seq[x]) cout << "1 ";
					else cout << "0 ";
			cout << xx << ' ' << yy << endl;
		}
	}
	cout << n << " " << m << endl;
	for (i=1; i<=n; ++i) if (seq[i]) cout << "1 "; else cout << "0 ";
	return 0;
}