Stack-average ------------- Eric uses a stack to keep track of his list of things to do. When he gets a new task, he writes it on a piece of paper and puts it on the top of the stack. (On the paper, he also records when he added the paper to his stack.) When he has some time to perform a task, he picks the top paper off of the stack and does the task described on the paper. Sometimes, Eric likes to know just how far behind he is, so he wants to know the average age of the papers on the stack. Eric wants to computerize his list of things to do (and maybe store it in the cloud so that he can access it wherever he is). Your job is to help him. You may assume that the stack will never contain more than 500000 tasks. INPUT ----- The input will consist of a positive integer n on a line by itself. Then there will be n lines describing a sequence of actions Eric takes. Each line will have of one of the following 3 formats: PUSH j t POP AVG t Here, j is a word describing a job and t is an integer, giving the time by describing the number of seconds that have elapsed since 12:00 midnight in the morning of January 1, 2015. "PUSH j t" indicates that the task named j should be added to the stack at time t. "POP" indicates that a job should be removed from the stack. "AVG t" indicates that at time t, Eric would like to know the average age of the jobs on the stack. The values of t used in the sequence of instructions will be strictly increasing. OUTPUT ------ For each POP instruction, output the name of the job that was removed from the top of the stack. For each AVG instruction, output the average age of the jobs on the stack in seconds (truncated so that it is an integer). If the stack is empty when an AVG instruction is encountered, output 0. If the stack is empty when a POP instruction is encountered, output "You're free; there is nothing to do!" SAMPLE INPUT ------------ 7 PUSH clean 12 PUSH cook 15 AVG 17 POP AVG 20 POP POP SAMPLE OUTPUT ------------- 3 cook 8 clean You're free; there is nothing to do!