A simple kidney exchange problem

Compatibility can involve many different attributes, but we only consider ABO blood groups for these tasks. All people have blood, but blood comes in four main groups. These are called O, A, B, and AB. A persons blood group helps determine both what people they can donate blood or organs to, and from what people they can recieve a blood transfusion or donor organ. The rules for these are shown in the following table.

Blood group Can donate to
O O,A,B,AB
A A,AB
B B,AB
AB AB

In this training scenario, we have three donor-recipient pairs that would all like to take part in a kidney exchange. The first pair consists of a blood group A donor and a blood group O recipient. We show this pair as an orange arrow. Note how it has an A written near the tip of the arrow (indicating that the donor has blood group A), while the end of the arrow has an O on it (indicating that the recipient has blood group O).

The second pair consists of a blood group O donor, and a blood group O recipient. The third pair consists of a blood group O donor, and a blood group AB recipient. All three pairs are shown below.

Can you move the three pairs into the exchange? You can drag and drop each pair, and they will automatically rotate to fit the slot. If a donation is not allowed due to blood group incompatibility, it will be highlighted in red.