// Created at 2021/01/30 20:53
// {TODO}WA, {TODO}min, {TODO}diff
// goal: {TODO}min
#include <bits/stdc++.h>
//#include <atcoder/all>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i, n) for (lint i = 0, i##_len = n; i < i##_len; i++)
#define rep2(i, n) for (lint i = 1, i##_len = n; i <= i##_len; i++)
#define rep3(i, s, e) for (lint i = s, i##_len = e; i < i##_len; i++)
#define all(i) (i).begin(), (i).end()
#define print(s) cout << s << "\n";
#define print2(s1, s2) cout << s1 << " " << s2 << "\n";
#define mk_p make_pair
using namespace std;
//using namespace atcoder;
using lint = long long;
using pi = pair<int, int>;
using pl = pair<lint, lint>;
using vi = vector<int>;
using vl = vector<lint>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using qi = queue<int>;
using ql = queue<lint>;
constexpr int INF = 1 << 30;
constexpr lint INFl = 1LL << 62;

template<class T, class U>
istream &operator>>(istream &is, pair <T, U> &pair) {
    is >> pair.first >> pair.second;
    return is;
}

template<class T, class U>
ostream &operator<<(ostream &os, pair <T, U> &pair) {
    os << pair.first << " " << pair.second;
    return os;
}

template<class T>
istream &operator>>(istream &is, vector <T> &vec) {
    for (auto &v : vec) is >> v;
    return is;
}

template<class T>
ostream &operator<<(ostream &os, const vector <T> &vec) {
    os << '[';
    for (auto v : vec) os << v << ',';
    os << ']';
    return os;
}

template<class T>
inline bool chmax(T &a, T b) {
    if (b > a) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cout << fixed << setprecision(15);
    /*----------------------------------------------------*/
    int n, s, d; cin >> n >> s >> d;
    vpi xy(n); cin >> xy;
    for (pi xyi : xy) {
        if (xyi.first < s && xyi.second > d) {
            print("Yes")
            return 0;
        }
    }
    print("No")
}
// 時間? メモリ?
// map->bucket?
// あまり->非負か確認
// set? multiset?
// オーバーフロー確認(最大値を求める)
// 入力確認
// 型確認
// ループ回数確認(TLE)
// 小数の計算は避けよう(割り算)(0割りだめ！絶対！)
// Python を使っては?
// 擬似コードを作っては?
// 汚くてもok

// Template
#include "bits/stdc++.h"
#define rep_override(x, y, z, name, ...) name
#define rep2(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep3(i, l, r) for (int i = (int)(l); i < (int)(r); ++i)
#define rep(...) rep_override(__VA_ARGS__, rep3, rep2)(__VA_ARGS__)
#define per(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003LL;
template <typename T>
inline bool chmin(T &x, const T &y) {
    if (x > y) {
        x = y;
        return true;
    }
    return false;
}
template <typename T> 
inline bool chmax(T &x, const T &y) {
    if (x < y) {
        x = y;
        return true;
    }
    return false;
}
struct IOSET {
    IOSET() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(10);
    }
} ioset;
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
    for (T &element : vec) is >> element;
    return is;
}
template <typename T>
vector<T> operator--(vector<T> &vec) {
    for (T &element : vec) --element;
    return vec;
}

// Union-Find
class UnionFind {
    std::vector<int> par;
    int n_;
    
public:
    UnionFind(int n) {
        assert(n >= 0);
        par.resize(n, -1);
        n_ = n;
    }
    
    int root(int x) {
        assert(x >= 0 && x < n_);
        if (par[x] < 0) return x;
        return par[x] = root(par[x]);
    }
    
    bool unite(int x, int y) {
        assert(x >= 0 && x < n_ && y >= 0 && y < n_);
        int rx = root(x), ry = root(y);
        if (rx == ry) return false;
        if (-par[rx] > -par[ry]) std::swap(rx, ry);
        par[ry] += par[rx];
        par[rx] = ry;
        return true;
    }
    
    bool same(int x, int y) {
        assert(x >= 0 && x < n_ && y >= 0 && y < n_);
        return root(x) == root(y);
    }
    
    int size(int x) {
        assert(x >= 0 && x < n_);
        return -par[root(x)];
    }
};

// Main
int main() {
    int n, m;
    cin >> n >> m;
    vector<ll> a(n), b(n);
    cin >> a >> b;
    UnionFind uf(n);
    rep(i, m) {
        int c, d;
        cin >> c >> d;
        --c; --d;
        uf.unite(c, d);
    }
    vector<ll> asum(n, 0), bsum(n, 0);
    rep(i, n) {
        asum[uf.root(i)] += a[i];
        bsum[uf.root(i)] += b[i];
    }
    rep(i, n) if (asum[i] != bsum[i]) {
        cout << "No\n";
        return 0;
    }
    cout << "Yes\n";
}
