class Node:
def __init__(self,addr):
self.addr=addr
self.next=None
self.back=None
class WebBrowser2:
def __init__(self):
self.homeAddr = 'www.hufs.ac.kr'
self.head = Node(self.homeAddr)
self.tail=Node(None)
self.head.back=None
self.head.next=self.tail
self.tail.back=self.head
self.tail.next=None
self.current = self.head
def forward(self):
if self.current.next is not None:
self.current=self.current.next
print(self.current.addr)
def backward(self):
if self.current!=self.head:
self.current=self.current.back
print(self.current.addr)
def go(self,addr):
location=Node(addr)
self.current.next=location
location.back=self.current
self.current=location
print(addr)
def history(self):
location=self.current
while location is not None:
self.current.next=location
location.back=self.current
location=self.current.next
while location is self.head:
print(location.addr)
location=location.back
'''
node=self.tail
while node is self.head:
print(node.addr)
node=node.back
'''
'''
result=[]
cur=self.tail
while cur.back.back:
cur=cur.back
result.append(cur.addr)
print(result)
'''
'''
ptr=self.head.back
while ptr is not self.head:
print(ptr.addr)
prt=ptr.back
'''
'''
while node is not None:
print(node.addr)
node=node.next
'''
w=WebBrowser2()
command=[]
while True:
A=input()
if A=='quit':break
command.append(A.split())
n=len(command)
print(w.homeAddr)
for i in range(n):
if(command[i][0]=='forward'):
w.forward()
elif command[i][0]=='backward':
w.backward()
elif command[i][0]=='go':
w.go(command[i][1])
elif command[i][0]=='history':
w.history()
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}