#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<stdlib.h>
#define N 1100
#include<map>
using namespace std;
int pre[N],indegree[N];
int find(int x) {
if(pre[x]!=x)
pre[x]=find(pre[x]);
return pre[x];
}
int judge(int n) {
int k=0,i;
for(i=1;i<=n;i++)
if(indegree[i]==0)
k++;
if(k==1)
return 1;
return 0;
}
map<string,int>p;
int main() {
int n,i,j,h,ans;
char s[N];
while(scanf("%d",&n),n) {
p.clear();
memset(indegree,0,sizeof(indegree));
for(i=1;i<N;i++)
pre[i]=i;
h=0;
while(n--) {
scanf("%s",s);
if(p.find(s)==p.end())
p[s]=++h;
i=p[s];
scanf("%s",s);
if(p.find(s)==p.end())
p[s]=++h;
j=p[s];
pre[find(i)]=pre[find(j)];
indegree[j]++;
}
ans=0;
for(i=1;i<=h;i++)
if(find(i)==i)
ans++;
if(judge(h)&&ans==1)
printf("Yes
");
else
printf("No
");
}
return 0;
}