You can try this formula:
=INDEX(D1:D6,MATCH(9^99,IF(IF((B1:B6="A")*(C1:C6="B1"),A1:A6)=MAX(IF((B1:B6="A")*(C1:C6="B1"),A1:A6)),ROW(D1:D6))))
This is an array formula, so you will need to use Ctrl + Shift + Enter to make it work as intended.
Jerry source share