Sightseeing Tour

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

A group of nn friends has decided to take a tour. They can visit some of mm cities during the tour.

The tour guide asked each person to tell her his wishes about visiting cities. Each person can claim for some cities that he wants to visit them, and for some other cities that he wants to avoid visiting them.

The group always travels together. If the group visits some city, all people who claimed that they want to avoid visiting that city get upset. If the group doesn't visit some city, all people who claimed that they want to visit that city get upset.

The guide understands that sometimes it is not possible to satisfy all wishes. She wants to make a plan which cities to visit, so that each person gets upset at most once.

Help the guide to choose which cities to visits to satisfy all wishes, except at most one for each person, or find out that it is impossible.

입력

The first line of input contains three integers: nn, mm and kk --- the number of friends, the number of cities and the total number of wishes (1n,m,k100,0001 \leq n, m, k \leq 100\\,000).

Each of the following kk lines contains two integers aa and bb and describes a wish (1an,1bm1 \leq a \leq n, 1 \leq |b| \leq m). If b>0b > 0, the person aa wants to visit the city bb. If b<0b < 0, the person aa wants to avoid visiting the city b-b. No wish is listed more than once, no person simultaneously wants to visit some city and to avoid visiting it.

출력

If there is no solution, output 1-1.

In the other case the first line of output must contain a single integer kk --- the number of cities to visit by the group.

The second line must contain kk integers --- the numbers of the cities to visit. They can be listed in any order.

If there are several possible correct answers, any of them can be printed. Note that you need not neither maximize nor minimize kk, you can output any correct answer.