#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> duo;

#define TT template<typename T>
TT T    sq(T x){ return x*x; }
TT int  ubnd(vector<T>& v,T x){ return upper_bound(v.begin(), v.end(), x) - v.begin(); }
TT int  lbnd(vector<T>& v,T x){ return lower_bound(v.begin(), v.end(), x) - v.begin(); }
TT void sort(T& v){ sort(v.begin(), v.end()); }
TT void revs(T& v){ reverse(v.begin(), v.end()); }
TT void uniq(T& v){ sort(v); v.erase(unique(v.begin(), v.end()), v.end()); }
TT void show(T& v,char d=' ',char e='\n'){for(int i=0;i<v.size();++i)cout<<v[i]<<((i==v.size()-1)?e:d);}
TT void inpt(vector<T>& v,int n){ v.reserve(n);for(int i=0;i<n;++i){T x; cin>>x; v.push_back(x);} }
TT T In(){ T x; cin >> x; return x; }

static inline void fast_io(){ ios::sync_with_stdio(0); cin.tie(0); }
static inline int in(){ int x; scanf("%d", &x); return x; }
static inline string instr(){ string x; cin >> x; return x; }
static const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
static const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
static const int _mod = 1000000000;
const int INF = 1 << 30;

struct Edge {
  int f, t, w;
  Edge(int f, int t, int w) : f(f), t(t), w(w) {}
  bool operator<(const Edge& e) const {
    return w == e.w ? f < e.f : w > e.w;
  }
};

struct Bldg {
  int x, y, id;
  Bldg(int id, int x, int y) : id(id), x(x), y(y) {}
  int dist(const Bldg& b){
    return sq(x - b.x) + sq(y - b.y);
  }
  bool movable(const Bldg& b){
    return sq(x - b.x) + sq(y - b.y) <= sq(50);
  }
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void shortestPath(const Graph& g, int s, vector<int>& dist, vector<int>& prev){
  int n = g.size();
  dist.assign(n, INF);
  dist[s] = 0;
  prev.assign(n, -1);
  priority_queue<Edge> Q;
  for (Q.push(Edge(-2, s, 0)); !Q.empty(); ){
    Edge e = Q.top();
    Q.pop();
    if (prev[e.t] != -1) continue;
    prev[e.t] = e.f;
    for (int i = 0; i < g[e.t].size(); i++){
      Edge f = g[e.t][i];
      if (dist[f.t] > e.w + f.w){
        dist[f.t] = e.w + f.w;
        Q.push(Edge(f.f, f.t, e.w + f.w));
      }
    }
  }
}

vector<int> buildPath(const vector<int>& prev, int t){
  vector<int> path;
  for (int u = t; u >= 0; u = prev[u]) path.push_back(u);
  revs(path);
  return path;
}

int main()
{
  int n;
  while (n = in()){
    Graph g(n + 1);
    vector<Bldg> bldgs;
    bldgs.reserve(n);
    for (int i = 0; i < n; i++){
      int id, x, y;
      id = in();
      x = in();
      y = in();
      bldgs.push_back(Bldg(id, x, y));
    }
    for (int i = 0; i < n; i++){
      for (int j = 0; j < n; j++){
        if (i == j) continue;
        if (!bldgs[i].movable(bldgs[j])) continue;
        g[bldgs[i].id].push_back(Edge(bldgs[i].id, bldgs[j].id, bldgs[i].dist(bldgs[j])));
      }
    }
    int m = in();
    for (int i = 0; i < m; i++){
      int s, e;
      s = in();
      e = in();
      vector<int> dist, prev;
      shortestPath(g, s, dist, prev);
      vector<int> path = buildPath(prev, e);
      if (dist[e] != INF) show(path);
      else puts("NA");
    }
  }
  return (0);
}