#include<bits/stdc++.h>
using namespace std;
int main(){
string s[100],a;
int n=0,m=0;
s[0]="http://www.acm.org/";
while(a!="QUIT"){
cin>>a;
if(a=="VISIT"){
n++;
cin>>s[n];
cout<<s[n]<<endl;
m=n;
}
if(a=="FORWARD"){
if(n<m){
n++;
cout<<s[n]<<endl;
}else{
cout<<"Ignored"<<endl;
}
}
if(a=="BACK"){
if(n>0){
n--;
cout<<s[n]<<endl;
}else{
cout<<"Ignored"<<endl;
}
}
}
}