#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define rep3(i, s, n) for (int i = (s); i > (int)(n); i--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define sz(x) ((int)(x).size())
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int X, Y; cin >> X >> Y;
    bool f;

    cout << (abs(X - Y) < 3 ? "Yes\n" : "No\n");

    return 0;
}
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll INF = ll(1e18) + 5;
struct edge {
    ll to, cost;
};

int main() {
    ll N, M;
    cin >> N >> M;
    vector<vector<edge>> g(N);
    rep(i, M) {
        ll A, B, C;
        cin >> A >> B >> C;
        --A;
        --B;
        g[A].push_back(edge{B, C});
    }

    rep(i, N) {
        vector<ll> d(N, INF);
        priority_queue<P, vector<P>, greater<P>> pq;
        pq.push(P(0, i));
        while (!pq.empty()) {
            P p = pq.top();
            pq.pop();
            if (p.first > d[p.second]) {
                continue;
            }

            for (edge e : g[p.second]) {
                if (d[e.to] > p.first + e.cost) {
                    d[e.to] = p.first + e.cost;
                    pq.push(P(d[e.to], e.to));
                }
            }
        }
        if (d[i] == INF) {
            cout << -1 << "\n";
        } else {
            cout << d[i] << "\n";
        }
    }

    return 0;
}