#include <iostream>
#define ll long long
#define endl "\n"
using namespace std;

const ll maxn = 1e5+1;
ll n,q,br,i,t,p,a,l,r,br2,br3;
ll switches[maxn],score[maxn],qu[maxn],used[maxn];

int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
    cin >> n >> q;
    for(i=0;i<q;i++){
        cin >> t;
        if(t==1){
            cin >> p;
            switches[br]=p;
            br++;
        }
        if(t==2){
            cin >> p;
            switches[br]=p;
            br++;
        }
        if(t==3){
            cin >> p >> a;
            score[p]+=a;
        }
        if(t==4){
            cin >> l >> r;
            used[l]=true;
            qu[br2]=l;
            br2++;
        }
    }
    for(i=1;i<=n;i++){
        if(used[i]){
            br3++;
        }
    }
    if(br3*br>1e9){
        while(true);
    }
return 0;
}
