#K66492. Fortunate Arrangements

    ID: 32432 Type: Default 1000ms 256MiB

Fortunate Arrangements

Fortunate Arrangements

You are given several test cases. For each test case, you are provided with an integer n that denotes the number of keys, followed by n keys (non-empty strings). Your task is to determine the number of fortunate arrangements according to the following rule:

  • If n is less than or equal to 2, then there is exactly 1 arrangement.
  • If n is greater than 2, then there is no fortunate arrangement (i.e. the answer is 0).

The answer should be output modulo \(998244353\). Note that since the only possible outputs are 0 and 1, the modulo operation does not affect the result.

inputFormat

The first line contains a single integer T indicating the number of test cases. Each test case consists of the following:

  1. A line with an integer n — the number of keys.
  2. n lines, each containing a key which is a non-empty string.

outputFormat

For each test case, output a single integer on a new line representing the number of fortunate arrangements modulo \(998244353\).

## sample
1
1
a
1

</p>