I nailed it:
awk '!a[$2]++ && !b[$3]++' input.txt |
awk '{print $4"\t"$5"\t"$3}' > output.txt
awk '!a[$2]++ && !b[$3]++' input.txt | cut -f 4,5 > first_part.txt
tac input.txt | awk '!a[$2]++ && !b[$3]' | tac | cut -f 6 > second_part.txt
paste first_part.txt second_part.txt > output.txt
but if you have fancier solutions, do not hesitate to share!