#include <bits/stdc++.h>
#define INF 1000000000000LL
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int n;
double G[101][101];

void dijkstra(int s,int g){
  ll D[101],from[101];
  for(int i=0;i<101;i++) D[i]=INF;
  
  priority_queue<P,vector<P>,greater<P> > Q;
  D[s]=0;
  Q.push(P(0,s));
  while(!Q.empty()){
    P t=Q.top(); Q.pop();
    ll pos=t.second,cost=t.first;
    if(pos==g) break;
    if(D[pos]<cost) continue;
    
    for(int i=0;i<n;i++){
      if(G[pos][i]==-1||i==pos)continue;
      if(cost+1<D[i]){
	Q.push(P(cost+1,i));
	D[i]=cost+1;
	from[i]=pos;
      }
    }
  }

  if(D[g]==INF){cout<<"NA"<<endl;return;}
    
  vector<int> res;
  res.push_back(g);
  int pos=g;
  while(pos!=s){
    pos=from[pos];
    res.push_back(pos);
  }

  for(int i=0;i<res.size();i++){
    if(i) cout<<" ";
    cout<<res[res.size()-1-i]+1;
  }
  cout<<endl;
}


int main(){
  while(cin>>n,n){

  double x[101],y[101];
  for(int i=0;i<n;i++){
    int b;
    cin>>b;
    cin>>x[b-1]>>y[b-1];
  }
  
  for(int i=0;i<n;i++)
    for(int j=i+1;j<n;j++){
      ll X=(x[i]-x[j]);
      ll Y=(y[i]-y[j]);
      ll dis=X*X+Y*Y;
      if(dis>50*50)G[i][j]=G[j][i]=-1;
      else G[i][j]=G[j][i]=dis;
    }

  int m;
  cin>>m;
  while(m--){
    int s,g;
    cin>>s>>g;
    dijkstra(s-1,g-1);
  }
  }
  return 0;
}