#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define allof(a) (a).begin(),(a).end()

int n, u, v;
vector< vector< int > > adj;
vector< int > dst;

void dfs(int v, int d) {
	if (dst[v] >= 0) return;
	dst[v] = d;
	for (int u : adj[v]) dfs(u, d + 1);
}

int main() {
	cin >> n >> u >> v;
	--u; --v;
	
	adj.assign(n, vector< int >());
	
	for_(i,0,n-1) {
		int a, b;
		cin >> a >> b;
		--a; --b;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	
	for_(v,0,n) sort(allof(adj[v]));
	
	vector< int > v_d3, leaf;
	
	for_(v,0,n) {
		if (adj[v].size() == 1) leaf.push_back(v);
		
		if (adj[v].size() == 3) v_d3.push_back(v);		
	
		if (adj[v].size() >= 4) {
			cout << "No" << endl;
			return 0;
		}
	}
	
	if (v_d3.size() > 2 || leaf.size() > 4) {
		cout << "No" << endl;
		return 0;
	}
	
	bool leaf_u = adj[u].size() == 1, leaf_v = adj[v].size() == 1;
	dst.assign(n, -1);
	
	if (v_d3.size() == 0) {
		// path graph
		if (leaf_u && leaf_v) {
			cout << (n % 2 ? "No" : "Yes") << endl;
		} else {
			if (leaf_u || leaf_v) {
				// u-inter, v-leaf
				if (leaf_u) swap(u, v);
				
				dfs(u, 0);
				
				int t = -1;
				for (int lf : leaf) if (lf != v) t = lf;
				
				cout << (dst[t] + 1 == dst[v] ? "Yes" : "No") << endl;
			} else {
				if (binary_search(allof(adj[u]), v)) {
					adj[u].erase(lower_bound(allof(adj[u]), v));
					adj[v].erase(lower_bound(allof(adj[v]), u));
					
					dfs(leaf[0], 0);
					dfs(leaf[1], 0);
					
					cout << (dst[u] == dst[v] ? "Yes" : "No") << endl;
				} else {
					cout << "No" << endl;
				}
			}
		}
	}
	
	if (v_d3.size() == 1) {		
		if (leaf_u && leaf_v) {
			dfs(v_d3[0], 0);
			
			int t = -1;
			for (int lf : leaf) if (lf != u && lf != v) t = lf;
			
			if (dst[u] == dst[v] + dst[t] + 1) cout << "Yes" << endl;
			else if (dst[v] == dst[u] + dst[t] + 1) cout << "Yes" << endl;
			else cout << "No" << endl;
		} else if (leaf_u || leaf_v) {
			// u-inter, v-leaf
			if (leaf_u) swap(u, v);
			
			if (binary_search(allof(adj[u]), v_d3[0])) {
				adj[u].erase(lower_bound(allof(adj[u]), v_d3[0]));
				adj[v_d3[0]].erase(lower_bound(allof(adj[v_d3[0]]), u));
				
				dfs(u, 0);
				dfs(v, 0);
				
				vector< int > lf;
				for (int s : leaf) if (s != v) lf.push_back(s);
				
				cout << (dst[lf[0]] == dst[lf[1]] && dst[lf[0]] != -1 ? "Yes" : "No") << endl;
				/*
				for (int s : leaf) {
					if (s == v) continue;
					
					for (int t : leaf) {
						if (t == v) continue;
						if (s <= t) continue;
						if (dst[s] == dst[t]) cout << "Yes" << endl;
						else cout << "No" << endl;
					}
				}
				*/
			} else {
				cout << "No" << endl;
			}
		} else {
			cout << "No" << endl;
		}
	}
	
	if (v_d3.size() == 2) {
		if (leaf_u && leaf_v) {
			if (binary_search(allof(adj[v_d3[0]]), v_d3[1])) {
				adj[v_d3[1]].erase(lower_bound(allof(adj[v_d3[1]]), v_d3[0]));
				adj[v_d3[0]].erase(lower_bound(allof(adj[v_d3[0]]), v_d3[1]));
			
				dfs(u, 0);
				dfs(v, 0);
				
				vector< int > lf;
				for (int s : leaf) if (s != u && s != v) lf.push_back(s);
				
				cout << (dst[lf[0]] == dst[lf[1]] && dst[lf[0]] != -1 ? "Yes" : "No") << endl;
				/*
				for (int s : leaf) {
					if (s == u || s == v) continue;
				
					for (int t : leaf) {
						if (t == u || t == v) continue;
						if (s <= t) continue;
						if (dst[s] == dst[t] && dst[s] != -1) cout << "Yes" << endl;
						else cout << "No" << endl;
					}
				}
				*/
			} else {
				cout << "No" << endl;
			}
		} else {
			cout << "No" << endl;
		}
	}
}

Measured memory_bytes: 11684