AT_abc445_e [ABC445E] Many LCMs
Description
You are given a sequence of positive integers $ A=(A_1,A_2,\dots,A_N) $ of length $ N $ .
For each $ k=1,2,\dots,N $ , find the remainder when the least common multiple of the $ N-1 $ elements of $ A $ excluding $ A_k $ is divided by $ 998244353 $ .
You are given $ T $ test cases; solve each of them.
Input Format
The input is given from Standard Input in the following format:
> $ T $ $ \mathrm{case}_1 $ $ \mathrm{case}_2 $ $ \vdots $ $ \mathrm{case}_T $
Here, $ \mathrm{case}_i $ denotes the input for the $ i $ -th test case. Each test case is given in the following format:
> $ N $ $ A_1 $ $ A_2 $ $ \cdots $ $ A_N $
Output Format
Output in the following format:
> $ \mathrm{answer}_1 $ $ \mathrm{answer}_2 $ $ \vdots $ $ \mathrm{answer}_T $
Here, $ \mathrm{answer}_i $ denotes the output for the $ i $ -th test case. For each test case, output as follows.
Let $ L_k $ be the remainder when the least common multiple of the $ N-1 $ elements of $ A $ excluding $ A_k $ is divided by $ 998244353 $ . Then, output in the following format:
> $ L_1 $ $ L_2 $ $ \cdots $ $ L_N $
Explanation/Hint
### Sample Explanation 1
For the first test case, the following holds.
- The $ N-1 $ elements of $ A $ excluding $ A_1 $ are $ 12,25,8,15 $ , and their least common multiple is $ 600 $ .
- The $ N-1 $ elements of $ A $ excluding $ A_2 $ are $ 9,25,8,15 $ , and their least common multiple is $ 1800 $ .
- The $ N-1 $ elements of $ A $ excluding $ A_3 $ are $ 9,12,8,15 $ , and their least common multiple is $ 360 $ .
- The $ N-1 $ elements of $ A $ excluding $ A_4 $ are $ 9,12,25,15 $ , and their least common multiple is $ 900 $ .
- The $ N-1 $ elements of $ A $ excluding $ A_5 $ are $ 9,12,25,8 $ , and their least common multiple is $ 1800 $ .
### Constraints
- $ 1 \leq T \leq 10^5 $
- $ 2 \leq N \leq 2 \times 10^5 $
- $ 1 \leq A_i \leq 10^7 $
- All input values are integers.
- The sum of $ N $ over all test cases in a single input is at most $ 2 \times 10^5 $ .