It is (supposedly) most likely at XXX, since the client will use old coins/transactions when sending 5 BTC from XXX to YYY.
Is this true? Do older coins get used first prior to newly deposited ones?
Hopefully, yes, unless the user has specifically stated otherwise (Coin control). Reason is is that high priority coins are actually free, so, the best method would be (Assuming you didn't care about mixing addresses), if:-
1. You can get a free transaction, use the highest priority input, but, use some sort of weighting system to try and weight it towards using old enough inputs that are closer to the value you're spending (So you don't reset the change for nothing)
2. If there's no free transaction, use the lowest priority coins (That aren't unconfirmed/from a brand new block), as, if you keep using the highest priority coins, then, you'll never get to a state where there's free transactions.
But, if you're like me, you never allow the client to prechoose, and, manually do everything yourself, I wouldn't want my gambling winnings to pay a real-life friend, as, that looks like I'm an addict gambler, I'm much rather use some input I got from a sale where neither address is really 'know' (I.E. google address and you won't find "JustDice.com" or something). On top of that, I like binding transactions up, if I have five inputs from a singular service of 0.01 (0.05 total), and, I'm paying someone 0.03, I'd rather place all the TXINs at 0.05, rather than 0.03, and, change myself 0.02, so that I have a larger TXIN that matures faster (Depending on how mature the inputs are already, however, that may or may not be worth it). In some cases, this can also result in a free transaction (As TXIN priorities are added together).