#include<stdio.h>
#include<string.h>
char b[50];
int count,a[27][27];
void dfs(int v)
{
int i,j;
if(a[v][12]) count=1;
else
{
for(i=0;i<26;i++)
if(a[v][i])
{
a[v][i]=0;
dfs(i);
a[v][i]=1;
}
}
}
int main()
{
while(scanf("%s",b)!=EOF)
{
memset(a,0,sizeof(a));
a[b[0]-'a'][b[strlen(b)-1]-'a']=1;
while(1)
{
scanf("%s",b);
if(b[0]=='0') break;
a[b[0]-'a'][b[strlen(b)-1]-'a']=1;
}
count=0;
dfs(1);
if(count) printf("Yes.\n");
else printf("No.\n");
}
return 0;
}