You are given two arrays b and c of length n, consisting of non-negative integers. Construct n×n matrix A as A_ij=b_i⊕c_j. Find the determinant of A modulo 998,244,353.
Each test contains multiple test cases. The first line contains an integer t (1≤t≤1000) --- the number of test cases. The descriptions of the t test cases follow.
The first line of each test case contains one integer n (1≤n≤5000).
The second line contains the array b_1,b_2,…,b_n (0≤b_i<260).
The third line contains the array c_1,c_2,…,c_n (0≤c_i<260).
The sum of n over all test cases does not exceed 10,000.
For each test case, print the determinant of matrix A modulo 998,244,353.
First test case:
6 134=6⋅4−1⋅3=21
Second test case:
23,792,195,055,071,677=23,792,195,055,071,677
23,792,195,055,071,677mod998,244,353=214,139,910
Third test case:
0 3 2 5301621075670=3⋅3⋅7⋅7−3⋅1⋅7⋅5−3⋅6⋅2⋅7−2⋅3⋅7⋅6+2⋅6⋅2⋅6−2⋅6⋅1⋅5−5⋅3⋅1⋅7−5⋅1⋅2⋅6+5⋅1⋅1⋅5=
=441−105−252−252+144−60−105−60+25=−224
(−224)mod998,244,353=998,244,129