Melandri inside top ten in qualification