#include<iostream>
#include<cmath>
#include<climits>
using namespace std;

int b[1000],cur_spot,start,goal,q[1000];
bool used[1000];
int x[1000],y[1000];
double mindist[1000],cur;


void dijkstra(int s,int g,int n){
  
  int cnt=0,keiro[1000],a;
  double kyori;
  
  for(int i=0 ; i < 1000 ; i++){
    mindist[i]=1000000;
    used[i]=0;
    q[i]=-1;
  }

  for(int i=0 ; i < n ; i++){
    if(b[i] == s){
      start=i;
    }else if( b[i] == g){
      goal=i;
    } 
  }
  
  mindist[start]=0;
  
  for(int i=0 ; i < n ; i++){
    cur=INT_MAX;
    for(int j=0 ; j < n ; j++){
      if(used[j]== 0){
	if(cur >= mindist[j]){
	  cur=mindist[j];
	  cur_spot=j;
	}
      }
    }      
    used[cur_spot]=1;
    
    for(int j=0 ; j < n ; j++){
      
      if(j == cur_spot)continue;
      
      kyori=sqrt((x[j]-x[cur_spot])*(x[j]-x[cur_spot])+(y[j]-y[cur_spot])*(y[j]-y[cur_spot]));
      
      if(kyori <= 50 && used[j] == 0){
	if(mindist[j] > mindist[cur_spot]+ kyori){
	  mindist[j]=mindist[cur_spot]+kyori;
	  q[j]=cur_spot;
	}
      }
    }
  }
  
  if(q[goal] == -1){
    cout <<"NA"<<endl;
  }else{
    a=goal;
    while(1){
      keiro[cnt]=b[a];
      a=q[a];
      if(a == -1)break;
      cnt++;
    }

    for(int i=cnt ; i >= 0 ; i--){
      cout <<keiro[i];
      if(i != 0)cout <<" ";
    }
    cout <<endl;
  }
}
int main(){
  
  int n,m,s,g;
  
  while(1){

    cin >> n;
    
    if(n == 0)break;
    
    for(int i=0 ; i < n ; i++){
      cin >>b[i]>>x[i]>>y[i];
    }
    
    cin >>m;
    
    for(int i=0 ; i < m ; i++){
      cin >>s>>g;
      dijkstra(s,g,n);
    }
  } 
  
  return 0;
  
}