A well worked lineout and big drive by the pack allowed number eight Amanaki Mafi to rumble over and put Japan ahead against Scotland.