You are given two integers $$$n$$$ and $$$m$$$, and $$$q$$$ restriction of the form $$$(l_i, r_i)$$$.
For each $$$k$$$ from $$$1$$$ to $$$q$$$, count, modulo $$$998\,244\,353$$$, the number of sequences of positive integers $$$a_1, a_2, \ldots, a_n$$$ such that the following conditions are satisfied:
The first line contains a single integer $$$t$$$ $$$(1 \leq t \leq 5 \cdot 10^4)$$$ — the number of test cases.
The first line of each test case contains three integers $$$n, m$$$ and $$$q$$$ $$$(1 \leq n, q \leq 3 \cdot 10^5, n \leq m \leq 10^6)$$$.
The $$$i$$$-th of the next $$$q$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ $$$(1 \leq l_i \leq r_i \leq n)$$$.
It is guaranteed that the sum of $$$q$$$ over all test cases does not exceed $$$3 \cdot 10^5$$$. Note that there are no constraints on the sum of $$$n$$$ or $$$m$$$.
For each test case, print $$$q$$$ integers on separate lines — the $$$k$$$-th integer represents the answer for $$$k$$$ modulo $$$998\,244\,353$$$.
23 10 21 22 34 6 31 23 41 4
900 810 1080 900 360
| Name |
|---|


