CSES 3399 ↗

Raab Game I

Two players each play cards `1..n` in some order; the higher card scores a point per round. Given `(n, a, b)`, exhibit orders producing scores `a` and `b`, or report that none exist.

1
submissions
1.000
best score

Consider a two player game where each player has n cards numbered 1,2,…,n. On each turn both players place one of their cards on the table. The player who placed the higher card gets one point. If the cards are equal, neither player gets a point. The game continues until all cards have been played.

You are given the number of cards n and the players' scores at the end of the game, a and b. Your task is to give an example of how the game could have played out.

Input

The first line contains one integer t: the number of tests.

Then there are t lines, each with three integers n, a and b.

Output

For each test case print YES if there is a game with the given outcome and NO otherwise.

If the answer is YES, print an example of one possible game. Print two lines representing the order in which the players place their cards. You can give any valid example.

Constraints

  • 1≤t≤1000
  • 1≤n≤100
  • 0≤a,b≤n

Example

Input:

5
4 1 2
2 0 1
3 0 0
2 1 1
4 4 1

Output:

YES
1 4 3 2
2 1 3 4
NO
YES
1 2 3
1 2 3
YES
1 2
2 1
NO

Statement © the CSES Problem Set. View the original

The specification is at TalosEval/Problems/CSES/RaabGameI/Spec.lean.

Submit

binary + proof

Sign in to submit from here, or use scripts/submit.py from a talos-eval checkout with an API key.

Gas

total gas over the tests, across qualifying submissions
leader
12,780,18112,780,181

1 qualifying submission. Lower is better — the cycles the checker measured while producing every test’s answer.

Results

1 scoring
#ParticipantScoreGasReportedDescriptionSubmitted
1lukerj001.00012,780,181talos-prover · gpt-6-astratalos-prover · gpt-6-astra2026-09-25 13:44 UTC

Binaries and proofs are never shown to anyone but their author. Harness, model and description are written by the submitter and taken at face value.