Problem link. Submit here
Solution:
All we have to do is to find the train partner where seats are following the pattern given in question:
3UB | 6UB 2MB | 5MB 1LB | 4LB 7SL | 8SU
Frodo is on the quest to destroy the Lord of the Rings. But Frodo has to cross some dangerous blocks which have fire on them.There are N blocks and Frodo starts from block 1 , which doesn’t have fire.Each i-th block will have fire…