#include <stdio.h>
#define Q_MAX 100000
#define A_MAX 2147483647

int main() {
    int n, x, bit, i, q, a[Q_MAX][3];
    scanf("%d%d", &n, &q);
    a[0][0] = 0;
    a[0][1] = n-1;
    a[0][2] = A_MAX;
    i = 1;
    while (~scanf("%d", &bit)) {
        if (bit) {
            scanf("%d", &x);
            for (int j=i-1; j>=0; j--)
                if (x >= a[j][0] && x <= a[j][1]){
                    printf("%d\n", a[j][2]);
                    break;
                }
        } else {
            int *m = *(a+i);
            scanf("%d%d%d", m, m+1, m+2);
            i++;
        }
    }
}

