input = $<.read.split.map(&:to_i) ans = [] Q = input.shift Q.times do v, x, fo, fi, q, r = input.shift(6) up = (fi - fo) * r down = -fo * (q - r) if x + up > v or up + down > 0 ans << "Overflow" elsif up + down < 0 ans << "Zero" else ans << "Safe" end end puts ans