### constant

DELTA = 1e-5

### subroutines

def aleq(a, b)
  (a - b).abs < DELTA
end

### main

n = gets.to_i

n.times do
  qr, rp, pq = gets.split.map(&:to_f)
  #p [qr, rp, pq]
    
  pn = gets.to_i
  pts = pn.times.map{gets.split.map(&:to_f)}
  #p pts

  qr_pq2 = (qr * qr) / (pq * pq)
  rp_pq2 = (rp * rp) / (pq * pq)
  #p [qr_pq2, rp_pq2]

  dists2 = pn.times.map{pn.times.map{nil}}
  for i in (0...pn)
    pxi, pyi, pzi = pts[i]
    for j in ((i + 1)...pn)
      pxj, pyj, pzj = pts[j]
      dists2[i][j] = (pxj - pxi) ** 2 + (pyj - pyi) ** 2 + (pzj - pzi) ** 2
    end
  end
  #p dists2

  ans = nil
  
  for i in (0...pn)
    for j in ((i + 1)...pn)
      dij = dists2[i][j]
      for k in ((j + 1)...pn)
        dik = dists2[i][k]
        djk = dists2[j][k]

        fik_ij = dik / dij
        fjk_ij = djk / dij
        if aleq(fik_ij, qr_pq2) && aleq(fjk_ij, rp_pq2)
          ans = [j, i, k]
          break
        end
        if aleq(fjk_ij, qr_pq2) && aleq(fik_ij, rp_pq2)
          ans = [i, j, k]
          break
        end

        fij_jk = dij / djk
        fik_jk = dik / djk
        if aleq(fij_jk, qr_pq2) && aleq(fik_jk, rp_pq2)
          ans = [k, j, i]
          break
        end
        if aleq(fik_jk, qr_pq2) && aleq(fij_jk, rp_pq2)
          ans = [j, k, i]
          break
        end

        fij_ik = dij / dik
        fjk_ik = djk / dik
        if aleq(fij_ik, qr_pq2) && aleq(fjk_ik, rp_pq2)
          ans = [k, i, j]
          break
        end
        if aleq(fjk_ik, qr_pq2) && aleq(fij_ik, rp_pq2)
          ans = [i, k, j]
          break
        end
      end
    end
    break if ans
  end

  puts ans.map{|i| i + 1}.join(' ')
end