Hi!
I have 1 table with State "On" and "Off" that belong to a certain machine, I want to order Off On Off On Off On considering that the "Off" following by the "One" are in the same machine.


Input:
State Machine
On A
On F
Off H
On D
On H
On A
Off B
Off B
Off F
Off K
On F
Off D
On B
Off A
....


Output:
State Machine
Off A
On A
Off B
On B
....




I really appreciate your help,