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 Output ↕ 4 4 5 4 5 4