#K35817. Arithmetic Progression Membership

    ID: 25616 Type: Default 1000ms 256MiB

Arithmetic Progression Membership

Arithmetic Progression Membership

You are given three integers a, d, and x. The task is to determine whether x appears in the arithmetic progression (AP) defined by its first term a and common difference d. The AP sequence is defined as:

a, a + d, a + 2d, a + 3d, \(\ldots\)

In mathematical terms, x belongs to the sequence if and only if \(x \ge a\) and \(x - a\) is divisible by \(d\), i.e., \[ x \in \{a+n \cdot d \mid n \in \mathbb{Z}, n \ge 0\} \iff \begin{cases} x \ge a\\ (x - a) \equiv 0 \; (\mathrm{mod} \; d) \end{cases} \]

In addition, you are required to answer multiple such queries.

inputFormat

The first line of input contains an integer T indicating the number of queries.

Each of the next T lines contains three integers a, d, and x separated by spaces.

outputFormat

For each query, output a single line containing YES if x belongs to the arithmetic progression starting at a with common difference d. Otherwise, output NO.

## sample
4
1 2 5
3 3 9
7 7 35
2 4 10
YES

YES YES YES

</p>