Ok. In the game, when you pick up an item from the inventory, you first take the item currently on screen, replacing the one at the top of the inventory. The second item then moves to the top, and the one you pick up takes its place. Afterward, the check (Flag-mast) is performed, and you obtain the flag and the mast. Since the key is in the top of the inventory, you leave it behind when you pick up the flag. Excuse my English; I used Google to speed things up.