#include<iostream>
#include<vector>
#include<cmath>
#include<queue>
using pii = std::pair<double, int>;

typedef struct edge{
  int from, to;
  double dist;
}edge;

typedef struct obj{
  int x, y;
}obj;

double dist(obj a, obj b){
  double i = (a.x - b.x), j = (a.y - b.y);
  return std::sqrt(i*i + j*j);
}

void solve(int s, int t, std::vector<std::vector<edge> > &G){
  int n = G.size();
  std::vector<int> ans(n, -1);  std::vector<double> d(n, 1e9);
  std::priority_queue<pii, std::vector<pii>, std::greater<pii>> que;
  que.push(pii(0, s));
  d[s] = 0;
  while(not que.empty()){
    int v = que.top().second;
    double c = que.top().first;
    que.pop();
    for (int i = 0; i < G[v].size(); i++) {
      int u = G[v][i].to;
      if(d[u] > c + G[v][i].dist){
        d[u] = c + G[v][i].dist;
        que.push(pii(d[u], u));
        ans[u] = v;
      }
    }
  }
  if(ans[t] == -1){
    std::cout << "NA" << std::endl;
    return;
  }
  std::vector<int> real_ans;
  real_ans.push_back(t);
  while(ans[t] != -1) {
    real_ans.push_back(ans[t]);
    t = ans[t];
  }
  for (int i = 0; i < real_ans.size(); i++) {
    std::cout << real_ans[real_ans.size() - i - 1] + 1;
    if(i == real_ans.size() - 1)std::cout << std::endl;
    else std::cout << " ";
  }
}
           

int main(){
  int n, m;
  while(std::cin >> n){
    if(n == 0) break;
    std::vector<std::vector<edge> > G(n);
    std::vector<obj> p(n);
    for (int i = 0; i < n; i++) {
      int b, x, y;
      std::cin >> b >> x >> y;
      p[--b] = obj{x, y};
    }
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        // std::cout << "i:" << i << " j:" << j << " " << dist(p[i], p[j]) << std::endl;
        if(dist(p[i], p[j]) <= 50.){
          // std::cout << "hoge" << std::endl;
          G[i].push_back(edge{i, j, dist(p[i], p[j])});
          G[j].push_back(edge{j, i, dist(p[i], p[j])});
        }
      }
    }
    std::cin >> m;
    for (int i = 0; i < m; i++) {
      int s, t;
      std::cin >> s >> t;
      solve(--s, --t, G);
      // std::cout << "s:" << s << " t:" << t << std::endl;
    }
  }
  return 0;
}

