Lionel Messi scored a hat-trick as Argentina beat arch-rivals Brazil 4-3 in an end-to-end friendly , dealing a blow to the Brazilians as they wrapped up their preparations for the London Olympics.