The first line contains four integers L, R, N and C. L (0≤L≤2000) is the capacity of the left cargo compartment, R (0≤R≤2000) is the capacity of the right cargo compartment, N (0≤N≤2000) is the number of capsules, and C (0≤C≤200000) is the number of conflicts.
Each of the next C lines describes one conflict with two integers X and Y (0≤X≤N−1, 0≤Y≤N−1, X=Y), meaning that capsule X and capsule Y cannot go into the same compartment. Each conflicting pair appears exactly once in the input. The capsules are numbered from 0 to N−1.