is working very hard for his senpai, . goes home, in his brand new car, named Rimuru. Everyone on DMOJ parks in this driveway, and with car names respective to the names of their username in DMOJ.
X
is going out and X
is the front car and X
is allowed to leave. This means that each time someone leaves from the front of the driveway,
Each day, there will be one action, either a car coming in or out.
Input Specification
Two integers,
Next
in
or out
, and
Output Specification
Output the car's names in order starting from the most inner car that is still in the driveway after
Sample Input
8 2
Xyene in
quantum in
magicalsoup in
bruce in
magicalsoup out
Xyene out
quantum out
quantum in
Sample Output
magicalsoup
bruce
quantum
Sample Explanation
The names are the cars in the driveway, as they come in from the right.
Day | Cars in Driveway |
---|---|
Xyene | |
Xyene, quantum | |
Xyene, quantum, magicalsoup | |
Xyene, quantum, magicalsoup, bruce | |
Xyene, quantum, magicalsoup, bruce | |
quantum, magicalsoup, bruce | |
magicalsoup, bruce | |
magicalsoup, bruce, quantum |
Comments