#include<algorithm>
#include<bitset>
#include<cassert>
#include<cfloat>
#include<climits>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;

using lint = long long;
using P = pair<int, int>;
using LLP = pair<long long, long long>;

#define REP(i, x, n) for(int i = (x), i##_len = (int)(n) ; i < i##_len ; ++i)
#define rep(i, n) for(int i = 0, i##_len = (int)(n) ; i < i##_len ; ++i)
#define reps(i, n) for(int i = 1, i##_len = (int)(n) ; i <= i##_len ; ++i)
#define rrep(i, n) for(int i = (int)(n) - 1 ; i >= 0 ; --i)
#define rreps(i, n) for(int i = (int)(n) ; i > 0 ; --i)
#define SORT(x) sort((x).begin(), (x).end())
#define SORT_INV(x) sort((x).rbegin(), (x).rend())
#define REVERSE(x) reverse((x).begin(), (x).end())
#define TWINS(x) cout << ((x) ? "Yay!" : ":(") << '\n'
#define endl '\n'

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;
constexpr double EPS = 1e-10;

constexpr int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
constexpr int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};

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

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

bool solve2(int n, vector<int> s, vector< vector<int> > g){
    vector< vector<int> > ls(2);
    int tmp = 0;
    rep(i, n){
        if((int)g[i].size() == 1){
            int now = i;
            int pre = -1;
            while((int)ls[tmp].size() < (n >> 1)){
                ls[tmp].emplace_back(now);
                for(auto to : g[now]){
                    if(to != pre){
                        pre = now;
                        now = to;
                        break;
                    }
                }
            }
            ++tmp;
        }
    }

    rep(i, 2){
        if((ls[i].front() == s[0] || ls[i].back() == s[0]) && (ls[i ^ 1].front() == s[1] || ls[i ^ 1].back() == s[1])){
            return true;
        }
    }

    return false;
}

bool solve3(int n, vector<int> s, vector< vector<int> > g){
    if((int)g[s[0]].size() != 1 && (int)g[s[1]].size() != 1){
        return false;
    }

    vector< vector<int> > ls(3);
    int tmp = 0;
    rep(i, n){
        if((int)g[i].size() == 1){
            int now = i;
            int pre = -1;
            bool flag = true;
            while(flag){
                flag = false;
                ls[tmp].emplace_back(now);
                for(auto to : g[now]){
                    if(to != pre && (int)g[to].size() < 3){
                        pre = now;
                        now = to;
                        flag = true;
                        break;
                    }
                }
            }
            ++tmp;
        }
    }

    tmp = -1;
    rep(i, 3){
        if((int)ls[i].size() == (n >> 1)){
            rep(j, 2){
                if(ls[i].front() == s[j] || ls[i].back() == s[j]){
                    tmp = j;
                    break;
                }
            }
        }
    }

    if(tmp == -1){
        return false;
    }

    return (int)g[s[tmp ^ 1]].size() == 1;
}

bool solve4(int n, vector<int> s, vector< vector<int> > g){
    if((int)g[s[0]].size() != 1 || (int)g[s[1]].size() != 1){
        return false;
    }

    vector< vector<int> > ls(4);
    int tmp = 0;
    rep(i, n){
        if((int)g[i].size() == 1){
            int now = i;
            int pre = -1;
            bool flag = true;
            while(flag){
                flag = false;
                ls[tmp].emplace_back(now);
                if((int)g[now].size() >= 3){
                    break;
                }
                for(auto to : g[now]){
                    if(to != pre){
                        pre = now;
                        now = to;
                        flag = true;
                        break;
                    }
                }
            }
            ++tmp;
        }
    }

    bool flag = false;

    rep(i, 4){
        for(auto to : g[ls[i].back()]){
            rep(j, 4){
                if(to == ls[j].back()){
                    flag = true;
                    break;
                }
            }
            if(flag){
                break;
            }
        }
        if(flag){
            break;
        }
    }

    if(!flag){
        return false;
    }

    rep(i, 4){
        rep(j, i){
            if(ls[i].back() == ls[j].back() && (int)ls[i].size() + (int)ls[j].size() - 1 == (n >> 1)){
                rep(k, 4){
                    rep(l, k){
                        if(k == i || k == j || l == i || l == j){
                            continue;
                        }
                        if((ls[i].front() == s[0] || ls[j].front() == s[0]) && (ls[k].front() == s[1] || ls[l].front() == s[1])){
                            return true;
                        }
                    }
                }
            }
        }
    }

    return false;
}

bool solve(void){
    int n;
    cin >> n;

    if(n & 1){
        return false;
    }

    vector<int> s(2);
    rep(i, 2){
        cin >> s[i];
        --s[i];
    }

    vector< vector<int> > g(n);
    rep(i, n - 1){
        int a, b;
        cin >> a >> b;
        g[--a].emplace_back(--b);
        g[b].emplace_back(a);
    }

    int cnt = 0;
    rep(i, n){
        cnt += (int)g[i].size() == 1;
    }

    if(cnt == 2){
        return solve2(n, s, g);
    }else if(cnt == 3){
        return solve3(n, s, g);
    }else if(cnt == 4){
        return solve4(n, s, g);
    }

    return false;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    if(solve()){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    cout << flush;

    return 0;
}


Measured memory_bytes: 14488