Sakshi and Art problem

only 2 testcases passes.
what kind of approch should i use?
plz provide only hints not ans.

@hari_2425
here we want that starting from a pointing we want to visit all the points in one stroke.
So for that checking only about connected components will not work. There must be path which is such that we can start from some point and end on some point.

Study a little about Euler path on google or youtube if you don’t know. what is euler path and how to check it and on what basis.
you can refer to these videos on yt -> https://www.youtube.com/watch?v=xR4sGgwtR2I

so, In euler path we have vertices which have odd degree, you need to count them.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.