//#pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cstdlib> #include<algorithm> #include<iostream> #include<sstream> #include<cmath> #include<climits> #include<string> #include<map> #include<queue> #include<vector> #include<stack> #include<set> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int,int> pii; #define pb(a) push(a) #define INF 0x1f1f1f1f #define lson idx<<1,l,mid #define rson idx<<1|1,mid+1,r #define PI 3.1415926535898 template<class T> T min(const T& a,const T& b,const T& c) { return min(min(a,b),min(a,c)); } template<class T> T max(const T& a,const T& b,const T& c) { return max(max(a,b),max(a,c)); } void debug() { #ifdef ONLINE_JUDGE #else freopen("d:\in1.txt","r",stdin); freopen("d:\out1.txt","w",stdout); #endif } int getch() { int ch; while((ch=getchar())!=EOF) { if(ch!=' '&&ch!=' ')return ch; } return EOF; } const int maxn=333; int n,m; vector<int> g[maxn]; int col[maxn]; bool dfs(int u,int color) { col[u]=color; for(int i=0;i<3;i++) { int v=g[u][i]; if(!col[v]) dfs(v,3-color); else if(col[v]==col[u])return false; } return true; } int main() { while(scanf("%d",&n)!=EOF&&n) { m=0; for(int i=0;i<=n;i++)g[i].clear(); while(1) { int u,v; scanf("%d%d",&u,&v); if(u==0&&v==0)break; m++; g[u].push_back(v); g[v].push_back(u); } int flag=1; memset(col,0,sizeof(col)); for(int i=1;i<=n;i++) { if(!col[i]) flag&=dfs(i,1); } printf("%s ",flag?"YES":"NO"); } return 0; }