S&P 500 and Nasdaq post best quarter since 2020, Dow notches best H1 in five years