#include <iostream>
#include "UFS.h"
using namespace std;
UFS ufs;
bool flag[MAXN]={0}, f;
int cnt_e, cnt_v;
void init();
int main()
{
int n,m;
init();
while(cin>>n>>m)
{
if(m==-1&&n==-1)return 0;
if(m==0&&n==0)
{
getchar();getchar();
if(f) cout<<"No"<<endl;
else if(cnt_v==0)cout<<"Yes"<<endl;
else if(cnt_v!=cnt_e+1)cout<<"No"<<endl;
else cout<<"Yes"<<endl;
init();
}
else
{
if(flag[m] == 0)
{
flag[m] = 1;
cnt_v++;
}
if(flag[n] == 0)
{
flag[n] = 1;
cnt_v++;
}
m = ufs.Find(m);
n = ufs.Find(n);
if(m==n) f=1;
else
{
ufs.Union(m, n);
cnt_e++;
}
}
}
return 0;
}
void init()
{
ufs.clear();
memset(flag, 0, sizeof(flag));
f = 0;
cnt_v = 0;
cnt_e = 0;
}