#include <bits/stdc++.h>
using namespace std;
 
typedef vector <int> vi;
typedef pair <int, int> pii;
typedef vector <long long> vll;
typedef pair <long long, long long> pll;
#define pb push_back   
#define all(c) c.begin(), c.end()
#define For(i, a, b) for (long long i = a; i < b; ++i)
#define Forr(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define ll long long 
#define endl "\n"
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1> void __f(const char* name, Arg1&& arg1) {cout << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) {const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
/*----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

const int N = 2010;
vector <pii> graph[N];
bool visited[N];
int dist[N];

int dijkstra(int org) {
	priority_queue <pii, vector <pii>, greater <pii>> pq;
	For(i,0,N) dist[i] = INT_MAX;
	memset(visited, 0, sizeof(visited));
	pq.push({0, org});
	bool f = 0;
	while (!pq.empty()) {
		int source = pq.top().S, d = pq.top().F;
		pq.pop();
		if (f and source == org) return d;
		f = 1;
		if (visited[source]) continue;
		visited[source] = 1;
		for (pii a : graph[source]) {
			if (dist[a.F] < d + a.S) continue;
			dist[a.F] = d + a.S;
			pq.push({d + a.S, a.F});
		}
	}
	return -1;
}

void solve() {
	int n,m; cin >> n >> m;
	For(i,0,m) {
		int u,v,c; cin >> u >> v >> c;
		graph[u].pb({v,c});
	}		
	For(i,1,n+1) {
		cout << dijkstra(i) << endl;
	}
}

int main() {
	fast_io();
	int t = 1;
	// cin >> t;
	while (t--) solve();
	return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define pb push_back
#define int long long int
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define F first
#define S second
#define mod 1000000007
#define MOD 998244353
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define deb(x) cout<< ">" << #x << '=' << x << endl;
#define read(v) for(auto &it:v) cin>>it;
const int  N = 2e5 + 5;
void solve() {
	int n, m, t;
	cin >> n >> m >> t;
	int prev = 0;
	int charge = n;
	int last;
	for (int i = 0; i < m; i++) {
		int l, r;
		cin >> l >> r;
		charge -= (l - prev);
		if (charge <= 0) {
			cout << "No" << endl;
			return;
		}
		charge += (r - l);
		charge = min(charge, n);
		prev = r;
	}
	charge -= (t - prev);
	if (charge > 0) {
		cout << "Yes" << endl;
		return;
	}
	else {
		cout << "No" << endl;
	}


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