Write a program that executes memory allocation commands in order.
The memory consists of 100,000 consecutive cells, addressed from 1 to 100,000. Initially, every cell is free.
Each command is one of the following.
var=malloc(size);
size. If such a block exists, allocate it and store its starting address in var. If no such block exists, store 0. (100 ≤ size ≤ 100,000)var already stores another address, that old allocation is not freed automatically.free(var);
var stores the starting address of a block from a previous successful malloc, free that block and store 0 in var. If var is already 0, nothing happens.print(var);
var.Every command ends with a semicolon (;). A variable name consists of exactly four lowercase English letters. There are at most 1,000 distinct variables, and every variable is initialized to 0.
The first line contains the number of commands N. (1 ≤ N ≤ 100,000)
Each of the next N lines contains one command, in the order it is executed.
At least one print command is given.
For each print command, output its result on its own line.