Magic flag and the magic needle trick