#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("No"); return 0;}
#define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
#define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{for(T&x:v)i>>x;return i;}
template<typename T>string join(vector<T>&v)
{stringstream s;for(T&x:v)s<<' '<<x;return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v)
{if(sz(v))o<<join(v);return o;}

const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

int n;
int s, t;
vvi to;
P e;

int dfs(int v, int p=-1) {
  int res = 1;
  for (int u : to[v]) if (u != p) {
    res += dfs(u,v);
  }
  if (res*2 == n) e = P(v,p);
  return res;
}

bool ok;
vi vs;
void efs(int v, int p) {
  vs.pb(v);
  int cnt = 0;
  for (int u : to[v]) if (u != p) {
    cnt++;
    efs(u,v);
  }
  if (cnt > 1) ok = false;
}
bool f(int v, int p) {
  int cnt = 0;
  vi a;
  for (int u : to[v]) if (u != p) {
    cnt++;
    if (cnt > 2) return false;
    ok = true; vs = vi();
    efs(u,v);
    if (!ok) return false;
    reverse(rng(a));
    if (cnt == 1) a.pb(v);
    a.insert(a.end(),rng(vs));
  }
  if (sz(a) == 0) return false;
  if (a[0] == s || a[0] == t) return true;
  if (a.back() == s || a.back() == t) return true;
  return false;
}

int main() {
  BEGIN_STACK_EXTEND(60*1024*1024);
  scanf("%d%d%d",&n,&s,&t);
  --s; --t;
  to = vvi(n);
  rep(i,n-1) {
    int a, b;
    scanf("%d%d",&a,&b);
    --a; --b;
    to[a].pb(b);
    to[b].pb(a);
  }
  dfs(0);
  if (e == P(0,0)) dame;
  if (!f(e.fi,e.se) || !f(e.se,e.fi)) dame;
  puts("Yes");
  END_STACK_EXTEND;
  return 0;
}

Measured memory_bytes: 13540