An ultra-secret spy organization is worried about a hidden conspiracy. To avoid groupthink, the organization splits its agents into two teams, and each team runs its own investigation.
Occasionally, members of different teams must interact through pre-designated contact points: pairs of agents on opposite teams who are permitted to talk to each other under special circumstances. To keep communication between the teams limited, the organization enforces one rule.
Any two agents on the same team may have at most one common contact on the other team.
You are given the planned set of contact points between the two teams. Determine whether the plan satisfies this rule.
The first line contains two space-separated integers $N$ and $M$ ($1 \le N, M \le 2000$), the number of agents on the first and second teams, respectively.
The second line contains an integer $K$ ($0 \le K \le N \cdot M$), the number of contact points.
Each of the next $K$ lines contains two integers $i$ and $j$ ($1 \le i \le N$, $1 \le j \le M$), meaning that agent $i$ of the first team and agent $j$ of the second team are allowed to communicate.
Output a single line containing YES if the plan satisfies the rule that any two agents on the same team have at most one common contact on the other team, and NO otherwise.