A.B7 B.B8 C.B9 D.B10
A.(rear+front)%m B.(rear-front+m)%m C.(rear-front)%m D.(rear-front+1)%m
A.3,4,1,2 B.4,2,1,3 C.4,1,2,3 D.1,3,4,2