#include <cstdio>
#include <iostream>
#include <cstring>
#include <cmath>
#include <cassert>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
#define pii pair <int, int>
#define pdd pair <double, double>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define INF 1000000005
#define NMAX (1 << 16)
#define LMAX 205
#define HMAX (1 << 8)
using namespace std;
int n, m, S[LMAX], A[NMAX];
int a, b, c, last;

int get2(int x)
{
	if (S[x] == 0)
		return 0;
	if (S[x] == HMAX)
		return 1;
	return -1;
}

int get1(int x)
{
	int res = get2(x >> 18);
	
	return res != -1 ? res : A[x];
}
 
int main()
{
    //~ freopen("input", "r", stdin);
    scanf("%d%d", &n, &m);
    n--;
    
    last = n >> 18;
    
    int type;
    for (int i = 1; i <= m; i++)
    {
		scanf("%d", &type);
		if (type == 1)
		{
			scanf("%d%d%d", &a, &b, &c);
			a--; b--;
			
			int x = a >> 18, y = b >> 18;
			for (int j = x + 1; j <= y - 1; j++)
				S[j] = c * HMAX;
			
			for (int j = a; j < ((x + 1) << 18) && j <= b; j++)
			{
				S[x] -= A[j];
				//~ printf("IN %d\n", j);
				A[j] = c;
				S[x] += c;
			}
			
			if (x < y)
			{
				for (int j = (y << 18); j <= b; j++)
				{
					S[y] -= A[j];
					A[j] = c;
					S[y] += c;
				}
			}
		}
		else
		{
			scanf("%d", &a);
			a--;
			int col = get1(a);
			
			int x = a >> 18;
			for (int j = a; j >= (x << 18); j--)
				if (get1(j) == col)
					b = j;
				else
					break ;
			
			if (b == (x << 18))
			{
				for (int j = x - 1; j >= 0; j--)
					if (get2(j) == col)
						b -= HMAX;
					else
					{
						for (int k = ((j + 1) << 18) - 1; k >= (j << 18); k--)
							if (get1(k) == col)
								b = k;
							else
								break ;
						break ;
					}
			}
			
			printf("%d %d ", col, b + 1);
			
			for (int j = a; j < ((x + 1) << 18) && j <= n; j++)
				if (get1(j) == col)
					b = j;
				else
					break ;
			
			if (b == ((x + 1) << 18) - 1)
			{
				for (int j = x + 1; j <= last; j++)
					if (get2(j) == col)
						b += HMAX;
					else
					{
						for (int k = (j << 18); k < ((j + 1) << 18); k++)
							if (get1(k) == col)
								b = k;
							else
								break ;
						break ;
					}
			}
			
			printf("%d\n", b + 1);
		}
    }
    return 0;
}