#include <cstdio>
#include <cmath>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <utility>

std::vector<size_t> nya(size_t s, size_t t, std::vector<std::vector<size_t>> const& via) {
  if (s == t) return {s};
  size_t k = via[s][t];
  if (k == s) return {s, t};

  auto former = nya(s, k, via);
  auto latter = nya(k, t, via);
  if (former.back() == latter[0])
    former.pop_back();

  former.insert(former.end(), latter.begin(), latter.end());
  return former;
}

int testcase_ends() {
  size_t n;
  scanf("%zu", &n);
  if (n == 0) return 1;

  double inf = 1e9;
  std::vector<std::vector<double>> g(n, std::vector<double>(n, inf));
  for (size_t i = 0; i < n; ++i) g[i][i] = 0;

  std::vector<double> x(n), y(n);
  for (size_t i = 0; i < n; ++i) {
    size_t b;
    scanf("%zu", &b);
    --b;
    scanf("%lf %lf", &x[b], &y[b]);
  }
  for (size_t i = 0; i < n; ++i) {
    for (size_t j = 0; j < n; ++j) {
      double dx = x[i]-x[j];
      double dy = y[i]-y[j];
      if (dx*dx + dy*dy > 50*50) continue;
      g[i][j] = g[j][i] = hypot(dx, dy);
    }
  }

  std::vector<std::vector<size_t>> via(n, std::vector<size_t>(n));
  for (size_t i = 0; i < n; ++i)
    for (size_t j = 0; j < n; ++j)
      via[i][j] = i;

  for (size_t k = 0; k < n; ++k)
    for (size_t i = 0; i < n; ++i)
      for (size_t j = 0; j < n; ++j) {
        if (g[i][j] > g[i][k] + g[k][j]) {
          g[i][j] = g[i][k] + g[k][j];
          via[i][j] = k;
        }
      }

  size_t m;
  scanf("%zu", &m);

  for (size_t i = 0; i < m; ++i) {
    size_t s, t;
    scanf("%zu %zu", &s, &t);
    --s;
    --t;
    if (g[s][t] >= inf) {
      puts("NA");
      continue;
    }
    std::vector<size_t> res = nya(s, t, via);
    for (size_t j = 0; j < res.size(); ++j)
      printf("%zu%c", res[j]+1, j+1<res.size()? ' ':'\n');
  }
  return 0;
}

int main() {
  while (!testcase_ends()) {}
}

