gets.to_i.times{
  gets
  p Complex(*(1..6).map{gets.split.map &:to_f}.find{|x,y|x>0.6&&y>-1e-12}).angle/Math::PI*180
}