#include<stdio.h>
#include<string.h> int main()
{
char s[][];
char str[];
int i,depth;
strcpy(s[],"http://www.acm.org/");
i=;
depth=;
while()
{
scanf("%s",str);
if(strcmp(str,"QUIT")==)
{
break;
}
if(strcmp(str,"VISIT")==)
{
scanf("%s",&s[++i]);
printf("%s\n",s[i]);
depth=i;
}
else if(strcmp(str,"BACK")==)
{
if(i>)
{
--i;
printf("%s\n",s[i]);
}
else
{
printf("Ignored\n");
}
}
else if(strcmp(str,"FORWARD")==)
{
if(depth>i)
{
++i;
printf("%s\n",s[i]);
}
else
{
printf("Ignored\n");
}
}
}
//system("pause");
return ;
}