- Commands
- New T1 W – creates a new "T1" train with one "W" car and inserts it into the trains' list.
- InsertFirst T1 W – appends existing "W" car to the beginnig of "T1" train.
- InsertLast T1 W – appends existing "W" car to the end of "T1" train.
- Display T1 – displays the whole "T1" train.
- Trains – displays all trains.
- Reverse T1 – reverses the order of cars in the "T1" train.
- Union T1 T2 – appends the whole "T2" train to the end of "T1" train and erases "T2" from list.
- DelFirst T1 T2 – deletes first car from "T1" train and creates a new "T2" car with the erased beforehand car assuming it's the last lement in list.
- DelLast T1 T2 – deletes last car from "T1" train and creates a new "T2" car with the erased beforehand car assuming it's the last element in list.
- Input:
- no. sets
- no. lines of the taken set
- line ...
- lines