This is one way.

Array-enter this formula in F3 and fill down.
Formula: copy to clipboard
 =IFERROR(INDEX($B$3:$B$15,SMALL(IF(G3=$D$3:$D$15,ROW($B$3:$B$15)-MIN(ROW($B$3:$B$15))+1),COUNTIF($G$3:G3,G3))),"") 
Then in H3 this array formula.
Formula: copy to clipboard
 =IFERROR(INDEX($B$3:$B$15,SMALL(IF(I3=$D$3:$D$15,ROW($B$3:$B$15)-MIN(ROW($B$3:$B$15))+1),COUNTIF($I$3:I3,I3))),"") 
and fill down.

If you aren’t familiar with array-entered formulas array enter means the formula must be committed from edit mode by simultaneously pressing and holding down Ctrl and Shift while hitting Enter.