Query related to devclass

Please give me a test case for type 2 or type 1.I’m getting ac for the first subtask but wa for d rest of them.

My solution runs perfectly for the sample test cases and even for my own test cases. But it gives me WA when submitted… don’t know why…

Please note that it is against the rules to ask for hints and test cases.