The input consists of several test cases. In the first line of each test case there are two integers m < 100 and d <= 1000, number of different integers in the key and number of given pairs, then in the next line there are m integers. The U+1th integer is the number of U's in the key . In the next d lines, in each line there is two integers x and y indicating that the pair ( x,y) is in the key. The test case with d=0 indicates the end o f file. If there is no solution for an input case you must report "Impossible!" as the output for this case.