#P7704. [2019年杭电多校]permutation 2

[2019年杭电多校]permutation 2

permutation 2

Problem Description

You are given three positive integers N,x,yN, x, y. Please calculate how many permutations of 1N1 \sim N satisfies the following conditions (We denote the ii-th number of a permutation by pip_i):

  1. p1=xp_1 = x
  2. pN=yp_N = y
  3. for all 1i<N1 \le i <N, pipi+12|p_i - p_{i+1}| \le 2

Input

The first line contains one integer TT denoting the number of tests. For each test, there is one line containing three integers N,x,yN, x, y.

  • 1T50001 \le T \le 5000
  • 2N1052 \le N \le 10^5
  • 1x<yN1 \le x < y \le N

Output

For each test, output one integer in a single line indicating the answer modulo 998244353998244353.

Sample Input

3

4 1 4

4 2 4

100000 514 51144

Sample Output

2

1

253604680

Source

2019 Multi-University Training Contest 5