Codeforces
CF Step
Youtube Linkedin Discord Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

Testcases : Chip and Ribbon

TC1

6

3
3 4 5

3
3 5 4

3
4 3 5

3
4 5 3

3
5 3 4

3
5 4 3
4
4
5
4
5
4