gets.to_i.times{ v,x,fo,fi,q,r=gets.split.map &:to_i old_x=x x+=(fi-fo)*r if x>v puts "Overflow" next end x-=fo*(q-r) if x<0 puts "Zero" next end t=10**100-q if old_x=0 puts "Overflow" else puts "Safe" end elsif old_x>x d=old_x-x need=x/d t-=need*q x-=need*d if fi>=fo t-=r x+=(fi-fo)*r else v=[x/(fo-fi)+1,r].min t-=v x-=(fo-fi)*v end needa=x/fo+1 t-=needa x-=needa*fo if t>=0 puts "Zero" else puts "Safe" end else puts "Safe" end }