#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



int main()
{
  while(true){
    ll N; cin>>N; if(N==0) break;
    vector<vector<pair<ll,double>>> graph(N,vector<pair<ll,double>>(0));
    
    //grid作成
    vector<pair<ll,ll>> grid(N);
    rep(i,N){
      ll b; cin>>b; b--;
      ll x,y; cin>>x>>y;
      grid.at(b)={x,y};
    }
    
    //重み付きグラフつくる
    rep(i,N){
      for(int j=i+1;j<N;j++){
        ll xi,yi,xj,yj;
        tie(xi,yi)=grid.at(i);
        tie(xj,yj)=grid.at(j);
        if((xi-xj)*(xi-xj)+(yi-yj)*(yi-yj)<=2500){
          graph.at(i).push_back({j,sqrt((xi-xj)*(xi-xj)+(yi-yj)*(yi-yj))});
          graph.at(j).push_back({i,sqrt((xi-xj)*(xi-xj)+(yi-yj)*(yi-yj))});
        }
      }
    }
    
    //bfs
    ll M; cin>>M;
    vector<double> table;
    vector<ll> memo;
    rep(i,M){
      table=vector<double>(N,INF);
      memo=vector<ll>(N);
      ll s,g; cin>>s>>g; s--; g--;
      queue<ll> que;
      que.push(s);
      table.at(s)=0;
      while(!que.empty()){
        auto node=que.front();;
        que.pop();
        for(auto hoge:graph.at(node)){
          ll p; double cost;
          tie(p,cost)=hoge;
          if(chmin(table.at(p),table.at(node)+cost)){
            memo.at(p)=node;
            que.push(p);
          }
        }
      }
      if(table.at(g)==INF) {cout<<"NA"<<endl; continue;}
      vector<ll> vec(1,g);
      while(true){
        if(vec.at(vec.size()-1)==s) break;
        ll n=vec.at(vec.size()-1);
        vec.push_back(memo.at(n));
      }
      reverse(vec.begin(),vec.end());
      ll sz=vec.size();
      rep(i,sz){
        if(i!=0) cout<<" ";
        cout<<vec.at(i)+1;
      }
      cout<<endl;
    }
  }

  return 0;
}

