solve the seat sequence problem