After the nuclear war, all the cities are experiencing nuclear pollution. They are affected by exactly two types of radiations.
Each of the cities is experiencing radiation of either Type 1 or Type 2 radiations (not both).
We can reduce the radiation of a city by connecting it by a bidirectional road to a city having radiation of different type. We can't connect two cities of same type directly or indirectly as it will increase the radiation instead of reducing it.
No. of cities experiencing Type 1 radiations is N and no. of cities experiencing Type 2 radiations is M. We want to find the no. of ways of arrangements of roads connecting the cities in such a way that radiations in some(possibly none or all) of the cities is reduced according to the above rules.
One arrangement of roads is different from another arrangement if at least one road connecting two cities present in one arrangement is not present in other arrangement
As answer could be too large, print the answer mod 998244353
INPUT:
The first line of input consists of a single integer T, denoting number of test cases.
Each of the next T lines contain two space separated integers N and M denoting the no. of cities experiencing Type 1 radiations and no. of cities experiencing Type 2 radiations respectively.
OUTPUT:
For each test case, output a single integer denoting the answer mod 998244353 in a single line.
CONSTRAINTS:
1≤ T ≤ 1000 0≤ N, M ≤ 5000
In first test case, there are only one way satisfying given conditions in which we don't construct any road.
In second test case, there are two ways satisfying given conditions. Either we don't construct any road or we construct a road between both cities.
All the participants need to register on the given link: goo.gl/MDh9FR