#include<bits/stdc++.h>
using namespace std;
typedef pair<double,int> P;
int n,m,si,ti;
int x[200],y[200];

double d[200];
int pre[200];

int dist(int a,int b){
  int X=x[a]-x[b];
  int Y=y[a]-y[b];
  return X*X+Y*Y;
}

void solve(int si,int ti){
  fill(d,d+200,1e9);
  fill(pre,pre+200,-1);
  
  d[si]=0;
  priority_queue< P , vector<P> , greater<P> > Q;
  Q.push(P(0,si));
  d[si]=0;
  while(!Q.empty()){
    P p=Q.top();Q.pop();
    double cost=p.first;
    int pos=p.second;
    if(cost>d[pos])continue;
    for(int i=1;i<=n;i++){
      if(dist(pos,i)>50*50)continue;
      double ncost=cost+ sqrt( (double)dist(pos,i) );
      if( d[i] > ncost ){
        d[i]=ncost;
        pre[i]=pos;
        Q.push(P(ncost,i));
      }
    }
  }
  vector<int> ans;
  int pos=ti;
  while(pos!=-1){
    ans.push_back(pos);
    pos=pre[pos];
  }
  reverse(ans.begin(),ans.end());

  if(ans.size()==1){
    cout<<"NA"<<endl;
    return;
  }
  
  for(int i=0;i<(int)ans.size();i++){
    if(i)cout<<' ';
    cout<<ans[i];
  }
  cout<<endl;
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;

    for(int i=0;i<n;i++){
      int id;
      cin>>id;
      cin>>x[id]>>y[id];
    }
    
    cin>>m;
    for(int i=0;i<m;i++){
      int si,ti;
      cin>>si>>ti;
      solve(si,ti);
    }
  }
  return 0;
}