Queen Game#3099

Queen Game

2 seconds
64 megabytes
Very easy

Queen game is played on a chessboard with rows and columns. Rows are numbered from to , and columns from to . The top-left square is at row and column . Two players play the game. Initially, there are queens placed on various squares of the chessboard. On each turn, a player picks a queen and moves it either vertically upwards, horizontally to the left, or diagonally up-left. The queen must always remain on the board. When a queen reaches square , it is removed from the board. The player who makes the last move wins. Each square is large enough to hold any number of queens. Players alternate turns. You are given the size of the chessboard and the initial positions of the queens. Assuming both players play optimally, determine who will win the game.

Input

The first line contains , the number of test cases. Each test case starts with a line containing three integers: (1 \leq R \leq 25), (1 \leq C \leq 10^{15}), and (1 \leq N \leq 1000). Each of the next lines contains the position of a queen, represented by two integers: row number and column number.

Output

For each test case, output "YES" if the first player has a winning strategy, and "NO" otherwise.

Examples

Example 1

Loading
Loading