def dist(p, q)
  Math.sqrt((0..2).reduce(0){ |s, i| s + (p[i] - q[i]) ** 2 })
end

n = gets.to_i
real = gets.split.map(&:to_f)
rank_k = real.map{ |r| real.sort.index(r) }
real.sort!

n.times do
  m = gets.to_i
  ps = m.times.map{ gets.split.map(&:to_f) }
  (0...m).to_a.combination(3) do |i, j, k|
    p = [i + 1, j + 1, k + 1]
    imag = [dist(ps[j], ps[k]), dist(ps[k], ps[i]), dist(ps[i], ps[j])]
    rank_im = imag.map{ |im| imag.sort.index(im) }
    imag.sort!
    if imag.zip(real).map{ |i, r| i / r }.combination(2).map{ |x, y| x / y }.all?{ |v| 1 - v < 0.001 }
      puts (0..2).map{ |i| p[rank_im.index(rank_k[i])]}.join(' ')
      break
    end
  end
end