Computers connected to the internet exchange information in units called packets. Computers are not linked one by one, so a packet usually passes through several routers before it reaches its destination. A router is like a parcel hub: it receives a packet and forwards it to the next router or, when the destination is directly connected, to that destination.
Inside a router there is a buffer that holds arriving packets for a short time. Packets wait in the buffer in arrival order, and the router handles them one by one from the front and removes each handled packet from the buffer. When packets arrive faster than the router handles them, the buffer fills up. A packet that arrives while the buffer is full is discarded, and every arrival keeps being discarded until free space appears.
Assume there is only one router. Given the record of arrivals and handling steps, write a program that reports the packets left in the buffer. Do not consider how a packet is handled in detail or where it is sent.