Oh, these hockey fans! They attend all the games of their favorite team
and don't care about their money or spare time. Often fans of a hockey
team from a city of Harbin gather in a small group of several thousand
people to visit the next match of their idols.
Harbin fans are well-organized. Each of them has his own ID number
that is an integer from 1 to n. All n fans decided to visit the next
match, so the fanclub ordered m buses and assigned the fans to buses
in such a way, that there would be at least a and at most b
fans in each bus. To avoid the mess, the buses were numbered 1 through m,
and every fan got a tag with a number of his bus. It is known that fans with
larger IDs were assigned to buses with larger numbers.
An emigrant from Vietnam, Li Si Tsyn is not accustomed to the discipline of his
comrades yet. When he came to a boarding station, he realized he had forgotten
a tag with his bus number at home! Li Si Tsyn asked several friends for their IDs
and their bus numbers. He wants to use this information to calculate the
number of his bus.
The first line contains space-separated integers n, m, a and
b (2 ≤ m ≤ n ≤ 105; 1 ≤ a ≤
b ≤ n;
ma ≤ n ≤ mb). The second line contains an
integer r (1 ≤ r ≤ n), which is the
Li Si Tsyn's ID. The third line contains an integer s (1 ≤
s ≤ n − 1), which is the number of fans asked by
Li Si Tsyn. The i-th of the next s lines contains space-separated
integers ri and fi (1
≤ ri ≤ n; 1 ≤ fi ≤
m), which are the ID of a fan and the number of his bus.
All ri are distinct and none of them is equal to r.
If the information received from the fans is inconsistent, output a single word
“IMPOSSIBLE”. Otherwise, in the first line you should output the number of
options that could be written on the Li Si Tsyn's tag, and in the the second line
you should output a space-separated list of these options in ascending order.
16 4 1 16
Problem Author: Alex Samsonov
Problem Source: XV Open USU Championship