### constant

MAX_X = MAX_Y = 10000.0
DELTA = 1e-8

CNRS = [[0.0, 0.0], [MAX_X, 0.0], [MAX_X, MAX_Y], [0.0, MAX_Y]]

### subroutines

def get_line(x0, y0, x1, y1)
  cx = (x0 + x1) / 2
  cy = (y0 + y1) / 2
  vx = -(y1 - y0)
  vy =  (x1 - x0)
  [cx, cy, vx, vy]
end

def i_prod(vx0, vy0, vx1, vy1)
  vx0 * vx1 + vy0 * vy1
end

def o_prod(vx0, vy0, vx1, vy1)
  vx0 * vy1 - vx1 * vy0
end

# x = vx0*s+cx0 = vx1*t+cx1
# y = vy0*s+cy0 = vy1*t+cy1
# |vx0 -vx1| |s| = |cx1-cx0|
# |vy0 -vy1| |t|   |cy1-cy0|
# |s| = 1/(vx0*vy1-vx1*vy0)|vy1 -vx1||cx1-cx0|
# |t|                      |vy0 -vx0||cy1-cy0|

def cross(cx0, cy0, vx0, vy0, cx1, cy1, vx1, vy1)
  d = o_prod(vx0, vy0, vx1, vy1)
  return nil if d == 0.0
  s = (vy1 * (cx1 - cx0) - vx1 * (cy1 - cy0)) / d
  [vx0 * s + cx0, vy0 * s + cy0]
end

def triangle(x0, y0, x1, y1, x2, y2)
  o_prod(x1 - x0, y1 - y0, x2 - x0, y2 - y0).abs / 2
end

def dist2(x0, y0, x1, y1)
  (x1 - x0) ** 2 + (y1 - y0) ** 2
end

def div_border(ix, iy, px, py, ax, ay, lip, lia)
  ptsi = 4.times.map{|i| [CNRS[i]]}
  $bls.each_with_index do |bl, i|
    for l in [lip, lia]
      pt = cross(*l, *bl)
      if pt &&
         pt[0] >= 0.0 && pt[0] <= MAX_X && pt[1] >= 0.0 && pt[1] <= MAX_Y
        ptsi[i] << pt
      end
    end
  end

  ptsi.each{|pts| pts.sort!}
  ptsi[2].reverse!
  ptsi[3].reverse!
  pts = ptsi.flatten(1).uniq

  nrsts = pts.map do |pt|
    d2i = dist2(ix, iy, *pt)
    d2p = dist2(px, py, *pt)
    d2a = dist2(ax, ay, *pt)
    (d2i <= d2p + DELTA && d2i <= d2a + DELTA)
  end

  [pts, nrsts]
end

### main

$bls = 4.times.map do |i|
  j = (i + 1) % 4
  vx = CNRS[j][0] - CNRS[i][0]
  vy = CNRS[j][1] - CNRS[i][1]
  [*CNRS[i], vx, vy]
end
#p $bls

seq = 0

loop do
  ix, iy, px, py, ax, ay = gets.split.map(&:to_f)
  break if ix == 0 && iy == 0 && px == 0 && py == 0 && ax == 0 && ay == 0

  lip = get_line(ix, iy, px, py)
  lia = get_line(ix, iy, ax, ay)

  ar = 0.0
  
  ci = cross(*lip, *lia)

  pts, nrsts = div_border(ix, iy, px, py, ax, ay, lip, lia)
  npts = pts.length
  #p ci
  #p pts
  #p nrsts
  
  if ci && ci[0] >= 0.0 && ci[0] <= MAX_X && ci[1] >= 0.0 && ci[1] <= MAX_Y
    for i in (0...npts)
      j = (i + 1) % npts
      if nrsts[i] && nrsts[j]
        ar += triangle(*ci, *pts[i], *pts[j])
      end
    end
  else
    while ! nrsts.first || nrsts.last
      pts.rotate!
      nrsts.rotate!
    end
    #p pts
    #p nrsts

    ply = (0...npts).select{|i| nrsts[i]}.map{|i| pts[i]}
    pt0 = ply.shift
    ply.each_cons(2) do |pt1, pt2|
      ar += triangle(*pt0, *pt1, *pt2)
    end
  end

  seq += 1
  puts [seq, "%.5f" % (ar / (MAX_X * MAX_Y))].join(' ')
end