The input contains at most 25 test cases. Each test case begins with 3 integers a, b and c, where c is the number of lost cards. The next line contains c strings, representing the lost cards. Each card is formatted as valueS, valueH, valueC or valueD, where value is a composite integer. No two lost cards are the same. The input is terminated by a=b=c=0. There will be at most one test case where a=1, b=50,000 and c<=10,000. For other test cases, 1<=a<=b<=100, 0<=c<=10.
For each test case, print b-a+1 integers, one in each line. Since the numbers might be large, you should output each integer modulo 1,000,000. Print a blank line after each test case.
The Seventh Hunan Collegiate Programming Contest