/*
用二位数组保存数据,接着一行一行搜
*/
#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int mark[30][30], dis[30];
bool p = false;
void work(int ch)
{
int i;
if(ch == 12)
p = true;
for( i=0; i < 26; i++ )
{
if(mark[ch][i] == 1 && dis[i] == 0)
{
dis[i] = 1;
work(i);
}
}
}
int main()
{
char str[100];
memset(mark, 0, sizeof(mark));
memset(dis, 0, sizeof(dis));
while(scanf("%s", str) != -1)
{
p = false;
if(strcmp(str, "0")==0)
{
printf("No.\n");
continue;
}
int len;
len = strlen(str);
mark[str[0]-'a'][str[len-1]-'a'] = 1;
while(scanf("%s", str) && strcmp(str,"0"))
{
len = strlen(str);
mark[str[0]-'a'][str[len-1]-'a'] = 1;
}
dis[1] = 1;
work(1);
if(p)
printf("Yes.\n");
else
printf("No.\n");
memset(dis, 0, sizeof(dis));
memset(mark, 0, sizeof(mark));
}
return 0;
}