//代码含全角空格
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int N=100005;//考虑同一连通图中有圈(不为树),图不连通(森林)
int root=0,n,m,fa[N],vis[N];
void inti(){
for(int i=1;i<=N;i++){
fa[i]=i;
}
}
int find(int x){
while(x!=fa[x]) x=fa[x]=fa[fa[x]]; return x;
}
void merge(int x,int y){
if(find(x)==find(y)){
root=2;
return ;
}
fa[find(y)]=find(x);
}
int main()
{
inti();
int maxn=0;
while(scanf("%d%d",&n,&m)==2&&n!=-1&&m!=-1){
if(!n||!m){
for(int i=1;i<=maxn;i++){
if(fa[i]==i&&vis[i])root++;
}
if(maxn==1||!maxn){cout<<"Yes"<<endl;continue;}
if(root!=1)cout<<"No"<<endl;
else cout<<"Yes"<<endl;
inti();
root=maxn=0;
memset(vis,0,sizeof(vis));
}
else{
maxn=max(maxn,n);
maxn=max(maxn,m);
vis[n]=vis[m]=1;
merge(n,m);
}
}
return 0;
}