M=Math
while 0<n=gets.to_i
z=(1..n).map{gets.split.map &:to_i}
gets.to_i.times{x,y,t,u=gets.split.map &:to_i
puts z.any?{|p,q,r|w=M.hypot(c=p-t,d=q-u)>r
r<M.hypot(a=p-x,b=q-y)?!w||((e=t-x)*b-(f=u-y)*a).abs<=r*M.hypot(x-t,y-u)&&(e*a+f*b)*(e*c+f*d)<0:w
}?:Safe:"Danger"}end