#include<iostream>
#include<stack>
using namespace std;
int main()
{
stack<string> a,b;
b.push("http://www.acm.org/");
string s;
while(cin>>s)
{
if(s=="QUIT") break;
if(s=="VISIT")
{
string str;cin>>str;
cout<<str<<endl;
b.push(str);
while(!a.empty()) a.pop();
}
if(s=="BACK")
{
if(b.size()>1)
{
a.push(b.top());b.pop();
cout<<b.top()<<endl;
}
else cout<<"Ignored"<<endl;
}
if(s=="FORWARD")
{
if(a.size()>0)
{
b.push(a.top());
cout<<b.top()<<endl;
a.pop();
}
else cout<<"Ignored"<<endl;
}
}
return 0;
}