#include <bits/stdc++.h> 
using namespace std;
const int N = 2 * 1e5 + 10;
long long a[N],b[N];
int n,w;
void insert(int l , int r , int c){
	b[l] += c;
	b[r] -=c;
}
int  main(){
	#ifndef ONLINE_JUDGE
		freopen("water_heater.txt","r",stdin);
	#endif
	ios::sync_with_stdio(false);
	cin >> n >> w;
	int maxt = -1;
	for(int i = 1; i <= n; i++){
		int s,t,k; cin >> s >> t >> k;
		maxt = max(maxt,t+1);
		insert(s+1,t+1,k);
	}
	for(int i = 1; i <= maxt + 10; i++) a[i] = a[i-1] + b[i];
//	for(int i = 1; i <= maxt + 10; i++) {
//		cout << a[i] << " ";
//	}
//	cout << endl;
	for(int i = 1; i <= maxt + 10; i++) {
		if(a[i] > w) {
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
//	cout << endl;
	return 0;
}





/* 
struct node{
	int l,r,w;
};
bool cmp(node &a,node &b){
	if(a.l != b.l){
		return a.l < b.l;
	}else{
		return a.r < b.r;
	}
}
const int N = 2 * 1e5 + 10;
typedef pair<int,int> PII;
int n,k;
node a[N];
int main(){
	#ifndef ONLINE_JUDGE
		freopen("water_heater.txt","r",stdin);
	#endif
	ios::sync_with_stdio(false);
	cin >> n >> k;
	for(int i = 0; i < n ; i++){
		cin >> a[i].l >> a[i].r >> a[i].w;
	}
	sort(a,a+n,cmp);
//	for(int i = 0 ; i < n ; i++){
//		cout << a[i].l <<";" << a[i].r <<endl;
//	}
//	cout << "-----------------" << endl;
	int sum_t = a[0].w , tail = a[0].r , curr = 0;
	for(int i = 1 ; i < n; i++){
		while(curr < i && tail <= a[i].l){
			sum_t -= a[curr++].w;
			tail = a[curr].r;
//			cout << "curr"<<curr << endl;
//			cout <<"tail:"<< a[curr].r <<endl;
		}
		if(i == curr) {
			sum_t = a[i].w;
		}
		if(tail > a[i].l){
			sum_t += a[i].w;
//			cout <<"sum_t:"<< sum_t << endl;
			if(sum_t > k){
				cout << "No" << endl;
				return 0;
			}
		}
		
//		cout << sum_t <<endl;
	}
	cout <<"Yes" << endl;
	return 0;
}

*/
#pragma GCC optimize("Ofast")

#include <iostream>
#include <fstream>
#include <algorithm>
#include <functional>
#include <array>
#include <chrono>
#include <random>
#include <vector>
#include <string>
#include <sstream>
#include <cmath>
#include <cstring>
#include <bitset>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cassert>

#define sq(x) ((x) * (x))
#define err(x) cerr << "["#x"]  " << (x) << "\n";
#define errp(x) cerr << "["#x"]  {" << ((x).first) << ", " << ((x).second) << "}\n";
#define errv(x) {cerr << "["#x"]  [";for(const auto& ___ : (x)) cerr << ___ << ", "; cerr << "]\n";}
#define errvn(x, n) {cerr << "["#x"]  [";for(auto ___ = 0; ___ < (n); ++___) cerr << (x)[___] << ", "; cerr << "]\n";}
#define errf() cerr << "\n\n";

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
ll getrnd(ll l, ll r) {
    return uniform_int_distribution<ll>(l, r)(rng);
}

template <typename T1, typename T2> inline bool relax(T1& a, const T2& b) {
    return a > b ? a = b, true : false;
}

template <typename T1, typename T2> inline bool strain(T1& a, const T2& b) {
    return a < b ? a = b, true : false;
}

// :::::::::::::::::::::::::::::::

const int N = 2e5 + 3, A = N * 2 + 3;

struct fenwick {
    int n;
    vector<ll> tr;
    
    fenwick(int n) : n(n), tr(n) {}
    
    void upd(int r, int x) {
        for (; r < n; r |= r + 1)
            tr[r] += x;
    }
    
    ll get(int r) {
        ll res = 0;
        for (; r >= 0; r &= r + 1, --r)
            res += tr[r];
        return res;
    }
    
    ll get(int l, int r) {
        return get(r) - get(l - 1);
    }
};

void solve() {
    int n, m, q;
    cin >> n >> m >> q;
    
    vector<int> ids = {0};
    vector<tuple<int, int, int>> qs;
    for (int i = 0; i < q; ++i) {
        int t, x, y;
        cin >> t >> x >> y;
        ids.emplace_back(y);
        qs.emplace_back(t, x - 1, y);
    }
    sort(ids.begin(), ids.end());
    ids.resize(unique(ids.begin(), ids.end()) - ids.begin());
    
    auto gid = [&](int x) {
        return lower_bound(ids.begin(), ids.end(), x) - ids.begin();
    };
    
    ll ans = 0;
    fenwick sa(A), sb(A), ca(A), cb(A);
    vector<int> a(n), b(m);
    for (int i = 0; i < n; ++i)
        ca.upd(0, 1);
    for (int i = 0; i < m; ++i)
        cb.upd(0, 1);
    
    for (auto [type, i, val] : qs) {
        if (type == 1) {
            int id = gid(a[i]);
            sa.upd(id, -a[i]);
            ca.upd(id, -1);
            int bef = cb.get(id);
            ans -= 1LL * bef * a[i];
            ans -= sb.get(id + 1, A - 1);
            
            a[i] = val;
            id = gid(a[i]);
            sa.upd(id, a[i]);
            ca.upd(id, 1);
            
            int blw = cb.get(id);
            ans += 1LL * blw * a[i];
            ans += sb.get(id + 1, A - 1);
        }
        else {
            int id = gid(b[i]);
            sb.upd(id, -b[i]);
            cb.upd(id, -1);
            int bef = ca.get(id);
            ans -= 1LL * bef * b[i];
            ans -= sa.get(id + 1, A - 1);
            
            b[i] = val;
            id = gid(b[i]);
            sb.upd(id, b[i]);
            cb.upd(id, 1);
            
            int blw = ca.get(id);
            ans += 1LL * blw * b[i];
            ans += sa.get(id + 1, A - 1);
        }
        cout << ans << '\n';
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr); cout.tie(nullptr);
    
    int t = 1;
//    cin >> t;
    while (t--)
        solve();
    
    return 0;
}
