Simulate the address bar of a browser that supports going back and forward through visited pages.
The first line gives q and the starting page home; when the session begins the current page is home and there is no back or forward history. Then q commands follow:
Moving BACK/FORWARD when there is nowhere further to go simply leaves you on the same page (and prints it).
Input format
Line 1: an integer q and a token home (the starting page).
Each of the next q lines is VISIT url, BACK n, FORWARD n, or CURRENT.
Page tokens (home, ) contain no spaces.
Output format
For each BACK, FORWARD, and CURRENT command, print the current page after the command. Print the results in command order, one per line.
Constraints
- 1 ≤ q ≤ 100000
- 1 ≤ n ≤ 1000000000
- Each page token is 1 to 30 characters of visible ASCII with no spaces.
- Every command is exactly one of the four forms above.