#include<iostream>
#include<vector>
#include<cassert>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<tuple>
#include<numeric>
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;
typedef ll int__;
#define rep(i,j) for(int__ i=0;i<(int__)(j);i++)
#define repeat(i,j,k) for(int__ i=(j);i<(int__)(k);i++)
#define all(v) v.begin(),v.end()

void fail(){
    cout << "No" << endl;
    exit(0);
}

void ok(){
    cout << "Yes" << endl;
    exit(0);
}

int u, v;
vector<vector<int>> E;

bool visit(int s, vector<bool> &visited){
    int n = E.size();
    int now = s;
    if(visited[now]) fail();
    rep(i, n / 2 -1){
        
        visited[now] = true;
        int nxt;
        if(E[now].size() == 1){
            nxt = E[now][0];
        } else {
            if(visited[E[now][0]]){
                nxt = E[now][1];
            } else {
                nxt = E[now][0];
            }
        }
        if(visited[nxt]) fail();
        now = nxt;
    }
    return true;
}

bool is_connected(int a, int b){
    return find(all(E[a]), b) != E[a].end();
}

bool erase_edge(int a, int b){
    auto p = find(all(E[a]), b);
    if(p != E[a].end()){
        E[a].erase(p);
        E[b].erase(find(all(E[b]), a));
        return true;
    } else return false;
}

int find_node(int s, int root){
    int depth = 0;
    int now = s;
    int pre = root;
    bool flg = true;
    bool special = false;
    if(s == u or s == v) special = true;
    while(flg){
        flg = false;
        if(not special and
           (now == u or now == v) ) return depth;
        for(int nxt : E[now]){
            if(nxt != pre){
                pre = now;
                now = nxt;
                depth++;
                flg = true;
                break;
            }
        }
    }
    return special ? depth : -1;
}



int main(){
    int n; cin >> n >> u >> v;
    u--; v--;
    E.resize(n);
    rep(i, n-1){
        int a, b; cin >> a >> b;
        a--; b--;
        E[a].push_back(b);
        E[b].push_back(a);
    }

    if(n %2 == 1) fail(); 
    rep(i, E.size()){
        if(E[i].size() > 3) fail();
    }
    
    vector<int> rank3, rank1;
    rep(i, n){
        if(E[i].size() == 1) rank1.push_back(i);
        if(E[i].size() == 3) rank3.push_back(i);
    }

    if(rank3.size() >= 3) fail();

    // ?¬???°?????\???????¬???°?????????????????§
    
    // ??????
    
    if(rank3.size() == 2){
        int a = rank3[0];
        int b = rank3[1];
        if(not erase_edge(a, b)) fail();
    } else if(rank3.size() == 1){    
        int found_num = 0;
        int mx = -1;
        int mx_node;
        for(int nxt : E[rank3[0]]){
            int tmp = find_node(nxt, rank3[0]);
            if(tmp >= 0) found_num++;
            if(mx < tmp){
                mx = tmp;
                mx_node = nxt;
            }
        }
        if(found_num != 2) fail();
        else{
            if(not erase_edge(rank3[0], mx_node)) fail();
            if(find( all(rank1), mx_node) == rank1.end()){
                rank1.push_back(mx_node);
            }
        }

    } else if(rank3.size() == 0){
        if(rank1.size() != 2) fail();
        int now = rank1[0], pre = -1;
        vector<int> ends;
        ends.push_back(now);
        rep(i, n-1){
            if(i == n / 2 -1 || i == n / 2){
                ends.push_back(now);
            }
            int nxt;
            if(E[now].size() == 1){
                nxt = E[now][0];
                if(pre == nxt) fail();
            } else {
                nxt = E[now][0] == pre ? E[now][1] : E[now][0];
            }
            pre = now;
            now = nxt;
        }
        ends.push_back(now);

        // rep(i,ends.size()){
        //     cout << ends[i] <<endl;
        // }
        
        if(  (ends[0] == u or ends[1] == u) and
             (ends[2] == v or ends[3] == v) ){
                ok();
        } else if( (ends[0] == v or ends[1] == v) and
                   (ends[2] == u or ends[3] == u) ){
                ok();
        } else {
            fail();
        }
        
    }

    // ???????????????
    if(rank1.size() == 4){
        vector<bool> visited(n);
        if(not visit(u, visited)) fail();
        if(not visit(v, visited)) fail();
        ok();
    } else fail();
    
    return 0;
}

Measured memory_bytes: 8404