Fixpoint append (q : queue data) : queue data -> queue data :=
  fun q2 : queue data =>
  match q with
  | empty => q2
  | input d q' => input data d (append q' q2)
  end.

Lemma in_q_shuffle : forall (m1 m2 : data) (q1 q2 q3 q4 : queue data), In_queue data m2 (append data q3 (input data m1 q4)) -> append data q1 q2 = append data q3 q4 -> In_queue data m2 (append data q1 (input data m1 q2)).