The Mid-Square hash function works as follows.
(1) The number of hash values is 65536, which are numbered from 0 to 65535.
(2) To obtain the hash value for an integer, the hash function squares the key and return 16 bits from the middle of the square; key is considered as a 32-bit unsigned integer.
Input will contain these commands:
(1) INSERT i – Insert the integer i into the hash.
(2) DELETE i – Delete the integer i from the hash, i will be in the hash table.
(3) PRINT i – Print the elements that have the same address as integer i in the hash table.
There is only one data set in the input. Each line contains a single command. The range of the given integer is considered as a 32-bit unsigned integer, and the number of commands will be no more than 200000. The input is terminated by end-of-file (EOF), and the hash table is initially empty.
For each “PRINT” command, output a line which contains integers of the same address as the given integer i in ascending order, including i. Each distinct integer should appear exactly once, and a single space character should be printed to separate two successive integers. In case that i is not found in the hash, print “Null” instead, even there are other integers in the same address of the hash table.