This story can be found in old Japanese illustrated book, Otogizōshi, and has been various forms around the world and is similar to the tradition of Tom Thumb in English folklore.