#include <bits/stdc++.h>

using namespace std;

int N;
vector< vector<int> > G;
vector<bool> used;

void remove_edge(int v1, int v2) {
	for (int i = 0; i < G[v1].size(); ++i) {
		if (G[v1][i] == v2) {
			G[v1].erase(G[v1].begin()+i);
			break;
		}
	}
	for (int i = 0; i < G[v2].size(); ++i) {
		if (G[v2][i] == v1) {
			G[v2].erase(G[v2].begin()+i);
			break;
		}
	}
}
void add_edge(int v1, int v2) {
	G[v1].push_back(v2);
	G[v2].push_back(v1);
}
int dfs(int v, int prev) {
	for (int i = 0; i < G[v].size(); ++i) {
		int to = G[v][i];
		if (to != prev) {
			return dfs(to, v)+1;
		}
	}
	return 1;
}
int getlen(int s) {
	return dfs(s, -1);
}
bool isConnected(int s, int t) {
	vector<bool> reached(N, false); reached[s] = true;
	queue<int> Q; Q.push(s);
	while ( !Q.empty() ) {
		int v = Q.front(); Q.pop();
		for (int i = 0; i < G[v].size(); ++i) {
			int to = G[v][i];
			if (!reached[to]) {
				reached[to] = true;
				Q.push(to);
			}
		}
	}
	return reached[t];
}
bool check(int v1, int v2) {
	if ( N % 2 == 1 ) return false;
	if ( isConnected(v1, v2) ) return false;
	if ( getlen(v1) == N/2 && getlen(v2) == N/2 ) return true;
	return false;
}
bool check2(int v, int v1, int v2) {
	vector<int> kh = G[v];
	for (int i = 0; i < kh.size(); ++i) {
		remove_edge(v, kh[i]);
		if (check(v1, v2)) return true;
		add_edge(v, kh[i]);
	}
	return false;
}
bool solve(int v1, int v2) {
	bool f = false;
	if (N % 2 == 1) return false;
	for (int i = 0; i < N; ++i) {
		if (G[i].size() == 3) {
			f = true;
		}
		else if (G[i].size() >= 4) {
			return false;
		}
	}
	if (f) { // delta G == 3
		vector<int> v;
		for (int i = 0; i < N; ++i) {
			if (G[i].size() == 3) {
				v.push_back(i);
			}
		}
		if (v.size() >= 3) return false;
		if (v.size() == 1) {
			return check2(v[0], v1, v2);
		}
		else {
			assert(v.size() == 2);
			bool isFind = false;
			for (int i = 0; i < G[v[0]].size(); ++i) {
				if (G[v[0]][i] == v[1]) {
					isFind = true;
				}
			}
			if (isFind) {
				remove_edge(v[0], v[1]);
				return check(v1, v2);
			}
			else {
				return false;
			}
		}
	}
	else { // delta G <= 2
		if ( check2(v1, v1, v2) ) return true;
		if ( check2(v2, v1, v2) ) return true;
		if (G[v1].size() == 1 && G[v2].size() == 1) {
			return true;
		}
		else {
			bool isFind = false;
			for (int i = 0; i < G[v1].size(); ++i) {
				if (G[v1][i] == v2) {
					isFind = true;
				}
			}
			remove_edge(v1, v2);
			return check(v1, v2);
		}
	}
}

int main() {
	cin >> N;
	G.resize(N);
	int v1, v2; cin >> v1 >> v2; --v1, --v2;
	for (int i = 0; i < N-1; ++i) {
		int u, v; cin >> u >> v; --u, --v;
		G[u].push_back(v);
		G[v].push_back(u);
	}
	if ( solve(v1, v2) ) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}