#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
typedef pair<double,double> P;

int main() {
  int n;
  while(cin >> n && n) {
    P a[n];
    for(int i=0,x,y,z; i<n; i++) {
      cin >> z >> x >> y;z--;
      a[z]=P(x,y);
    }
    int m;
    cin >> m;
    while(m--) {
      int s,t;
      cin >> s >> t;s--,t--;
      int p[n];double d[n];
      fill(d,d+n,1<<30);
      d[s]=0;
      p[s]=-1;
      priority_queue<P,vector<P>,greater<P> > que;
      que.push(P(0,s));
      while(!que.empty()) {
        P pp=que.top();que.pop();
        int x=pp.S;
        double c=pp.F;
        if(d[x]<c) continue;
        for(int i=0; i<n; i++) {
          double dd=sqrt((a[i].F-a[x].F)*(a[i].F-a[x].F)+(a[i].S-a[x].S)*(a[i].S-a[x].S));
          if(dd<=50&&d[i]>d[x]+dd) {
            d[i]=d[x]+dd;
            p[i]=x;
            que.push(P(d[i],i));
          }
        }
      }
      if(d[t]==1<<30) {
        cout << "NA" << endl;
        continue;
      }
      vector<int> ans;
      while(t!=s) {
        ans.push_back(t);
        t=p[t];
      }
      ans.push_back(s);
      reverse(ans.begin(),ans.end());
      for(int i=0; i<ans.size(); i++) {
        if(i) cout << " ";
        cout << ans[i]+1;
      }
      cout << endl;
    }
  }
  return 0;
}
