
object Main extends App {

  import scala.io.StdIn._
  solve
  def solve: Unit = {
    val n = readLine.trim.toInt
    if (n != 0){
      val buildings = Array.tabulate(n){_ ⇒
        val Array(b, x, y) = readLine.trim.split(' ').map(_.toInt)
        new Building(b, Coordinate(x, y))
      }.sortBy(_.id)
      val memo = Array.tabulate(n){_ ⇒ Array.tabulate(n){_ ⇒new Route(-1, Double.MaxValue)}}
      val networks = calNetwork(buildings)
      for (from ← networks.indices){
        memo(from)(from).distance = 0
        for (to ← networks(from)){
          memo(from)(to) = new Route(to, buildings(from).distance(buildings(to)))
          memo(to)(from) = new Route(from, buildings(to).distance(buildings(from)))
        }
      }
      for (a ← 0 until n){
        for (i ← 0 until n){
          for (j ← 0 until n){
            if (memo(i)(j).distance - memo(i)(a).distance > memo(a)(j).distance) {
              memo(i)(j) = new Route(memo(i)(a).from, memo(i)(a).distance + memo(a)(j).distance)
            }
          }
        }
      }
      for (_ ← 0 until readLine.trim.toInt){
        val Array(s, g) = readLine.trim.split(' ').map(_.toInt - 1)
        var stack = g::Nil
        while (memo(stack.head)(s).from != -1){
          stack ::= memo(stack.head)(s).from
        }
        println (if (stack.head == s) stack.map(_ + 1).mkString(" ") else "NA")
      }
      solve
    }
  }
  class Route(var from: Int, var distance: Double)
  def calNetwork(buildings: Array[Building]): Array[List[Int]] = {
    val res = Array.tabulate(buildings.length){_ ⇒ Nil: List[Int]}
    for (i ← buildings.indices){
      for (j ← buildings.indices){
        if (i != j && buildings(i).canJumpTo(buildings(j))) {
          res(i) ::= j
        }
      }
    }
    res
  }
  case class Coordinate(x: Int, y: Int) {
    def - (that: Coordinate): Coordinate = Coordinate(this.x - that.x, this.y - that.y)
  }
  class Building(val id: Int, val position: Coordinate)
  {
    def canJumpTo(that: Building): Boolean = (this.position - that.position).let(it ⇒ it.x * it.x + it.y * it.y <= 50 * 50)
    def distance(that: Building): Double = (this.position - that.position).let(it ⇒ math.sqrt(it.x * it.x + it.y * it.y))
  }
  implicit class ScopeFunc[T](val value:T){
    def let[A](func: T ⇒ A): A = func(value)
  }
}
