Answered by ZUPAN | Apr. 29, 2019 03:11
Well, we have:
Denver - San Francisco - Shanghai - Japan
Japan - Shanghai - (certain layover in some place) - Denver
This is fine and allows you to apply for 144 hours visa free twice or you can apply for 24 hours visa free during your first stay in Shanghai if you will be there less than 24 hours. Please, just take all the necessary documentation, i.e. flight tickets and hotel bookings in Shanghai in printed form.
In the end, please, just be informed that your flight from Shanghai to Denver is allowed to have a layover, but not in Japan. I assume that it will be a layover again in US and if I am right, then everything is just fine.