import java.util.ArrayList;
import java.util.Scanner;



public class prog {
	
	public static void main( String[] args ) {
		int n;
		int m;
		int x, y, z;
		ArrayList<int[]> operations = new ArrayList<int[]>();
		ArrayList<Integer> listaNr = new ArrayList<Integer>();
		int[] operation = new int[3];
		Scanner scanner = new Scanner(System.in);
		//read n and m
		
		String line = scanner.nextLine();
		String[] strs = line.trim().split("\\s+");
	
		n = Integer.parseInt(strs[0]);
		m = Integer.parseInt(strs[1]);
		//System.out.print(n + " " + m);
		
		//read operations
		for(int i = 0; i<m; i++) { 
			line = scanner.nextLine();
			strs = line.trim().split("\\s+");
			x = Integer.parseInt(strs[0]);
			y = Integer.parseInt(strs[1]);
			if (x == 1) {
				z = Integer.parseInt(strs[2]);
			}
			else
				z = -1;
			operation = new int[]{x, y, z};
			operations.add(operation);
		}
		//System.out.print(n + " " + m + "\n");
		//for(int i = 0; i<m; i++) { 
		//	System.out.print(operations.get(i)[0] + " " + operations.get(i)[1] + " " + operations.get(i)[2] + "\n");
		//}
		// create list filled with zeros
		for(int i = 0; i<n; i++) { 
			listaNr.add(0);
		}
		// calculate...
		for(int[] lista: operations) {
			if (lista[0] == 1) {
				for(int i = lista[1] - 1; i <= lista[2] - 1; i++) {
					if (listaNr.get(i) == 0)
						listaNr.set(i, 1);
					else
						listaNr.set(i, 0);
				}
			}
			if (lista[0] == 2) {
				//----------------------------------------------------
				int p = lista[1] - 1;
				int[] boundaries = new int[3];
				int lower = p, upper = p;
				int nr = listaNr.get(p);
				boundaries[0] = nr;
				boolean ok = true;

				while(lower > 0) {
					lower--;
					if (listaNr.get(lower) != nr) {
						ok = false;
						boundaries[1] =  lower + 2;
						break;
					}
				}
				if (ok)
					boundaries[1] = lower + 1;
					
				ok = true;
				while(upper < listaNr.size() - 1) {
					upper++;
					if (listaNr.get(upper) != nr) {
						ok = false;
						boundaries[2] = upper;
						break;
					}
				}
				if (ok) 
					boundaries[2] = upper + 1;
				System.out.print(boundaries[0] + " " + boundaries[1] + " " + boundaries[2] + "\n");
			}
		}
	}
}