#include<stdio.h>
#include<string.h>
int M[1000][1000];
int Path[10000];
typedef struct
{
   char name[3];
   int bfs;
   int path;
   
}Graph;
Graph node[1000];
int nodes;
int source,dest;
int Q[100000];
int V[101];
int rear,front;
int empty;
int line;
void enqueue(int x)
{
    V[x] = 1;
    rear = (rear+1)%100000;
    Q[rear] = x;
}
int dequeue()
{
    if(!isEmpty())
    {
       front = (front+1)%100000;
       return Q[front];
    }
}
int isEmpty()
{
    return front==rear;
}
int find(char str[5])
{
    int i;
    for(i=0;i < nodes;i++)
       if(!strcmp(str,node[i].name))
          return i;
    return -1;
}
int BFS(int start)
{
   int v;
   int i;
   int find = 0;
   enqueue(start);
   V[start] = 1;
   while(!isEmpty())
   {
      v = dequeue();
      if(v==dest)
      {
         return node[v].bfs;
         break;
      }
      for(i = 0;i < nodes;i++)
      {
         if(M[v][i]&&!V[i])
         {
            V[i] = 1;
            node[i].bfs = node[v].bfs + 1;
            node[i].path = v;
            enqueue(i);
            
            
         }
      }
   }
   return 0;
   
}
int main()
{
    int n;
    int i,j,k=1;
    char t1[5];
    char t2[5];
    char from[5];
    char to[5];
    int x,y;
    int d = 0;
    int prev;
    int num;
    
    
    while(scanf("%d",&n)==1)
    {
        if(line!=0)             
           printf("\n");
        line++;
     
        for(i=0; i< n;i++)
        {
            scanf("%s %s",t1,t2);
            if(find(t1)==-1)
              strcpy(node[nodes++].name,t1);
            if(find(t2)==-1)
              strcpy(node[nodes++].name,t2);
            
            M[find(t1)][find(t2)] = M[find(t2)][find(t1)] = 1;

        }
        scanf("%s %s",from,to);
        
        source = find(from);   
        dest = find(to);     
        node[source].bfs = 0;

        if(BFS(source))
        { 
           
           Path[d++] = dest;
           num = node[dest].path;
           
           while(num!=source)
           {
              Path[d++] = num;
              num = node[num].path;
              
           }
           Path[d++] = source;
           for(i=d-1;i>0;i--)
              printf("%s %s\n",node[Path[i]].name,node[Path[i-1]].name);
        }
        else if(source==dest)
        {
           
        }
        else
           printf("No route\n");
           
        
        for(i = 0;i < nodes;i++)
           for(j = 0;j < nodes;j++)
              M[i][j] = 0;
        for(i = 0;i < nodes;i++)
        {
           node[i].bfs = 0;
           node[i].path = 0;
           strcpy(node[i].name,"");
           V[i]=0;
        }
        for(i = 0;i < d;i++)
           Path[i]=0;
        for(i = 0;i < 100000;i++)
           Q[i] = 0;
        source = 0;
        dest = 0;
        prev = 0;
        d = 0;
        nodes = 0;
        front = rear = 0;
        num = 0;
    }
    return 0;
}
