Welcome to ZOJ
Select Problem
ZOJ Problem Set - 2960

Time Limit: 2 Seconds      Memory Limit: 65536 KB

The problem made whatashya need be rejudged again, and this time he comes to you for help. So fool as he is, he isn't able to get the right input and output efficiently. Assume that the solution is always right, and there is something wrong with the input. As it's unsuitable to public the input and output, so what you can do is just telling him the least time he need to fix his input.

There are three kinds of input errors:
1.'p' - Presentation Error: there are spaces, blank lines, etc against the problem description;
2.'r' - Range Error: the data is out of range said in problem input;
3.'n' - Number_of_data Error: the number of cases or other data is not exactly the same as the description or other input indicated.

And each time poor whatashya can do these operations:
1.'pf' - Presentation Fix: fix the Presentation Error in some continuous cases;
2.'rf' - Range Fix: fix the Range Error in some continuous cases;
3.'nf' - Number_of_data Fix: fix the Number_of_data Error in some continuous cases; (continuous cases means that the cases in input is continuous, and all of these cases have that kind of error!);
4.'del' - Delete Cases: delete some continuous cases;
5.'add' - Add Case: add one new case.
Operation 1 to 3 need 2 rejudges each time, while operation 4 and 5 need only 1 rejudge.

Now give you the number of case in the input and some strings describe the errors in it. Find the least times of rejudges. The number of cases should keep the same.


There will be multiple cases. Each case begin with a integer N (N will not be more than 505) indicating the number of cases in the wrong input. Then N strings follow, each stands for a case and lenth for each string is less than 20. If the case is right, the string will be "o". Otherwise it will be made by 'p','r' and 'n' (e.g. "pr" or "nnpn").


For each case, output a line telling the least times of rejudges. The output should be in the form as follow:
1. If the problem needs no rejudge, output "Impossible!";
2. If the problem needs to rejudge strictly more than 200 times, output "pia2de4!";
3. Else output "(re-)rejudge", the number of (re-) is times of rejudge - 1.

Sample Input

o o
prn prn prn prn
prn pnr rpn rnp npr nrp

Sample Output


Author: WU, Zejun
Source: ZOJ Monthly, May 2008
Submit    Status