#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
using vb = vector<bool>;
using vi = vector<int>; using vvi = vector<vector<int>>;
using vl = vector<ll>; using vvl = vector<vector<ll>>;
using pii = pair<int,int>; using pll = pair<ll,ll>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
const ll INF = 1e10;
//#define int ll
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
struct edge{
  ll to;
  double cost;
};
double calc_dist(ll x1,ll y1,ll x2,ll y2){
  return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}
using vve = vector<vector<edge>>;
bool operator>(edge left,edge right){
  return left.cost > right.cost;
}
using vve = vector<vector<edge>>;
vl dijkstra(vve &gr,int st,int g){
  int n = gr.size();
  vl dist(n,INF);
  vl last(n);
  last[st] = -1;
  priority_queue<pii,vector<pii>,greater<pii>> q;
  dist[st] = 0;
  q.push(make_pair(dist[st]=0,st));
  while(!q.empty()){
    int now = q.top().second;
    q.pop();
    REP(i,gr[now].size()){
      edge &e = gr[now][i];
      if(dist[now]+e.cost<dist[e.to]){
        dist[e.to] = dist[now]+e.cost;
        last[e.to] = now;
        q.push({dist[e.to],e.to});
      }
    }
  }
  if(dist[g]<INF) return last;
  return vl(n,-2);
}
signed main(){
  int n;
  while(cin >> n,n){
    vl s(n),x(n),y(n);
    REP(i,n){
      cin >> s[i] >> x[i] >> y[i];
      --s[i];
    }
    vector<vector<edge>> gr(n);
    REP(i,n) REP(j,n){
      double r;
      if((r = calc_dist(x[i],y[i],x[j],y[j]))>50) continue;
      gr[s[i]].emplace_back(edge{s[j],r});
    }
    int m;
    cin >> m;
    REP(i,m){
      int t,g;
      cin >> t >> g;
      --t; --g;
      auto last = dijkstra(gr,t,g);
      if(last[g]==-2){
        cout << "NA" << endl;
        continue;
      }
      int id = g;
      vl ans;
      ans.eb(id);
      while(last[id]!=-1){
        ans.eb(id=last[id]);
      }
      reverse(ALL(ans));
      REP(i,ans.size()){
        if(i==(ll)ans.size()-1){
          cout << ans[i]+1 << endl;
          break;
        }
        cout << ans[i]+1 << " ";
      }
    }
  }
}
