Grid Toll

Time limit: 0.2sMemory limit: 256MBInput: Output:

You start at cell (1,1)(1,1) of a grid with NN rows and MM columns, and want to reach cell (N,M)(N,M). From a cell you may only move right or down, and every move costs a toll:

  • Moving right from (i,j)(i,j) to (i,j+1)(i,j+1) costs ii;
  • Moving down from (i,j)(i,j) to (i+1,j)(i+1,j) costs jj.

Some moves in a grid with N=4N=4 rows and M=5M=5 columns, with their tolls. Moving right (blue) costs the row number, moving down (orange) costs the column number. The start is green, the target is red.

Is there a path from (1,1)(1,1) to (N,M)(N,M) whose total cost is exactly KK? You have to answer TT independent queries.

Input data

The first line contains the integer TT, the number of queries. Each of the next TT lines contains three integers NN, MM and KK.

Output data

You need to write TT lines: the ii-th line must contain YES if there exists a path of total cost exactly KK in the ii-th query, and NO otherwise. The answers are case-insensitive: for example, yes and Yes are also accepted.

Constraints and clarifications

  • 1≤T≤100 0001 \le T \le 100\ 000.
  • 1≤N,M≤1 000 000 0001 \le N,M \le 1\ 000\ 000\ 000.
  • 0≤K≤10180 \le K \le 10^{18}.
# Score Constraints
0 0 Examples.
1 20 T≤100T \le 100, N,M≤10N,M \le 10.
2 30 T≤100T \le 100, N,M≤100 000N,M \le 100\ 000.
3 50 No additional restrictions.

Example

stdin

2
2 3 5
1 1 0

stdout

YES
YES

Explanation

In the first sample case, the grid has 22 rows and 33 columns. The path (1,1)→(1,2)→(1,3)→(2,3)(1,1) \to (1,2) \to (1,3) \to (2,3) costs 1+1+3=51+1+3=5. In the second query the grid is a single cell and the cost is 00.

Example

stdin

3
3 3 8
2 5 10
4 1 4

stdout

YES
NO
NO

Explanation

In the second sample case, there are multiple paths in a 3×33 \times 3 grid with cost 88, so the answer is YES for K=8K=8. It can be shown that there is no path with cost 1010 in a grid of size 2×52 \times 5 and no path of cost 44 in a 4×14 \times 1 grid.

Log In or Sign Up to be able to send submissions!