// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

struct Naive {
    int N;
    vector<ll> A, B;
    Naive(int N, vector<ll> A, vector<ll> B) : N(N), A(A), B(B) {}

    // [l, r)
    void update(int l, int r, ll x) {
        for(int i=l; i<r; i++) A[i] += x;
    }

    // [l, r)
    ll query(int l, int r) {
        ll ans = LONGINF;
        for(int i=l; i<r; i++) ans = min(ans, max(A[i], B[i]));
        return ans;
    }
};

int main() {
    const int B = 320;
    int N, Q; cin >> N >> Q;
    vector<ll> add(B), X(B*B, -LONGINF), Y(B*B, LONGINF);
    vector< vector< pair<ll, ll> > > elems(B);
    vector< vector<ll> > minX(B, vector<ll>(B+2, LONGINF));
    vector< vector<ll> > minY(B, vector<ll>(B+2, LONGINF));
    for(int i=0; i<N; i++) {
        cin >> X[i] >> Y[i];
        elems[i/B].emplace_back(X[i], Y[i]);
    }

    // Naive naive(N, X, Y);

    auto compare_ysubx = [&](auto a, auto b) {
        ll x1, y1; tie(x1, y1) = a;
        ll x2, y2; tie(x2, y2) = b;
        return y1 - x1 < y2 - x2;
    };
    
    for(int k=0; k<B; k++) {
        sort(elems[k].begin(), elems[k].end(), compare_ysubx);
        for(int i=0; i<(int)elems[k].size(); i++) {
            minX[k][i+1] = min(minX[k][i], elems[k][i].first);
        }
        for(int i=(int)elems[k].size()-1; i>=0; i--) {
            minY[k][i+1] = min(minY[k][i+2], elems[k][i].second);
        }
    }

    for(int z=0; z<Q; z++) {
        int t; cin >> t;
        if(t == 1) {
            ll l, r, x; cin >> l >> r >> x; l--; r--;
            ll bl = l/B, br = r/B;

            /* left */
            for(int i=bl*B; i<(bl+1)*B; i++) {
                if(l <= i and i <= r) X[i] += x;
            }
            elems[bl].clear();
            fill(minX[bl].begin(), minX[bl].end(), LONGINF);
            fill(minY[bl].begin(), minY[bl].end(), LONGINF);
            for(int i=bl*B; i<(bl+1)*B; i++) {
                elems[bl].emplace_back(X[i], Y[i]);
            }
            sort(elems[bl].begin(), elems[bl].end(), compare_ysubx);
            for(int i=0; i<(int)elems[bl].size(); i++) {
                minX[bl][i+1] = min(minX[bl][i], elems[bl][i].first);
            }
            for(int i=(int)elems[bl].size()-1; i>=0; i--) {
                minY[bl][i+1] = min(minY[bl][i+2], elems[bl][i].second);
            }
            
            /* mid */
            for(ll k=bl+1; k<br; k++) {
                add[k] += x;
            }

            /* right */
            // fprintf(stderr, "cand: %d %d, bl = %d, br = %d\n", (br-1)*B, l, bl, br);
            for(int i=br*B; bl!=br and i<(br+1)*B; i++) {
                if(l <= i and i <= r) X[i] += x;
            }
            elems[br].clear();
            fill(minX[br].begin(), minX[br].end(), LONGINF);
            fill(minY[br].begin(), minY[br].end(), LONGINF);
            for(int i=br*B; i<(br+1)*B; i++) {
                elems[br].emplace_back(X[i], Y[i]);
            }
            sort(elems[br].begin(), elems[br].end(), compare_ysubx);
            for(int i=0; i<(int)elems[br].size(); i++) {
                minX[br][i+1] = min(minX[br][i], elems[br][i].first);
            }
            for(int i=(int)elems[br].size()-1; i>=0; i--) {
                minY[br][i+1] = min(minY[br][i+2], elems[br][i].second);
            }

            // naive.update(l, r+1, x);
        }
        if(t == 2) {
            ll l, r; cin >> l >> r; l--; r--;
            ll bl = l/B, br = r/B, res = LONGINF;

            /* left */
            for(int i=bl*B; i<(bl+1)*B; i++) {
                if(i < l or r < i) continue;
                ll x = X[i] + add[i/B];
                ll y = Y[i];
                chmin(res, max(x, y));
            }
            
            /* mid */
            for(int k=bl+1; k<br; k++) {
                /*
                for(int i=0; i<B; i++) {
                    fprintf(stderr, "elem: %lld %lld\n", elems[k][i].first, elems[k][i].second);
                }
                */
                
                int ub = elems[k].size(), lb = -1;
                while(ub - lb > 1) {
                    int mid = (ub + lb) / 2;
                    ll val = elems[k][mid].second - (elems[k][mid].first + add[k]);
                    if(val >= 0) ub = mid;
                    else lb = mid;
                }

                // ub 以上の要素は最大値が b でそれ未満は a
                // [0, M] (a)
                ll vl = minX[k][lb + 1] + add[k];
                // [1, M+1] (b)
                ll vr = minY[k][ub + 1];
                /*
                fprintf(stderr, "lb = %d, ub = %d\n", lb, ub);
                fprintf(stderr, "vl = %lld, vr = %lld\n", vl, vr);
                */                
                chmin(res, min(vl, vr));
            }

            /* right */
            for(int i=br*B; bl!=br and i<(br+1)*B; i++) {
                if(i < l or r < i) continue;
                ll x = X[i] + add[i/B];
                ll y = Y[i];
                chmin(res, max(x, y));
            }
            printf("%lld\n", res);
            // assert(naive.query(l, r+1) == res);
        }

        /*
        fprintf(stderr, "# X table\n");
        for(int i=0; i<N; i++) {
            fprintf(stderr, "%lld ", X[i]);
        }
        fprintf(stderr, "\n");
        fprintf(stderr, "# Y table\n");
        for(int i=0; i<N; i++) {
            fprintf(stderr, "%lld ", Y[i]);
        }
        fprintf(stderr, "\n");
        fprintf(stderr, "# add table\n");
        for(int i=0; i<B; i++) {
            fprintf(stderr, "[%d, %d): %lld\n", i*B, (i+1)*B, add[i]);
        }
        */
    }

    assert(B >= 320);
    return 0;
}



Measured memory_bytes: 8648