Flip output and db