#include <string>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <cmath>
#define ROPE 50
#define NEXTD -30

using namespace std;
void reachable();
double dist(int,int);
int inv_in(int,int);

int index_[1000],x[1000],y[1000];
double dst[1000][1000];
int next[1000][1000];


int main(){
  //  int tmp;
  int b_num,root_num;
  //int index[1000],x[1000],y[1000];
  int s_index[1000],g_index[1000];
  //int map[1000];
  while(cin >> b_num && b_num!=0){
    //cin >> a;
    //cout << b_num << " Number of Buildings." <<endl;
    //cout << a << endl;


    //rîñÇÝÝA£vZ
    for(int i=0;i<b_num;i++){  
      //while(cin >>tmp){
      cin >> index_[i] >> x[i] >> y[i];
      //cout << index_[i] <<" " << x[i] <<" "<< y[i] << endl;
      for(int j=0;j<=i;j++){
	dst[i][j]= (dist(i,j) > 50.0) ? 10000000.0 : 100000+dist(i,j);
	dst[j][i]= dst[i][j];
	next[i][j] = (dist(i,j) > 50.0) ? NEXTD : j;
	next[j][i] = (dist(i,j) > 50.0) ? NEXTD : i;
      }
    }

    for(int k=0; k<b_num;k++){
      for(int i =0; i<b_num; i++){
	for(int j =0; j<b_num; j++){
	  if(dst[i][j] > dst[i][k] + dst[k][j]){
	    //cout << dst[i][j] << "Í" << dst[i][k] << "Æ" << dst[k][j] << "æèå«¢";
	    dst[i][j] = dst[i][k] + dst[k][j];
	    next[i][j] = next[i][k];
	    //cout << i << "ida" << j << "jda" << next[i][j] << "£XV" << endl;
	  }
	  //cout << i <<"ida" << j << "jda" << next[i][j] <<endl;
	}
      }
    }
    
    cin >> root_num;
    for(int i=0;i < root_num;i++){
      int S,G;
      cin >> s_index[i] >> g_index[i];
      S=inv_in(b_num,s_index[i]);
      G=inv_in(b_num,g_index[i]);
      //cout << s_index[i] <<" " << g_index[i] <<" Start and Goal index"<< endl;
      //cout << inv_in(b_num,s_index[i]) <<" " << inv_in(b_num,g_index[i]) 
      //	   <<" Start and Goal num"<< endl;
      
      //cout << "S" << S << "G" << G << endl;
     
      
      if(next[i][G]!=NEXTD){
	for(int j=S;j!=G;j=next[j][G]){
	  cout << index_[j] << ' ' ;
	}
	cout << index_[G] << endl;
      }
      else{
	cout << "NA" << endl;
      } 
       
    }
    
    
    /*
    for(int i=0;i<b_num;i++){
      for(int k=0;k<b_num;k++){
	cout << next[i][k] << " -> " << i << "Æ" << k << "ÆÌÔÌÌs«æ" << endl; 
	//	dst[i][j]
      }
      cout << endl;
    }
    */
  }
  
}

void reachable(int i){
  if(dist(i,i+1) <=ROPE){
    cout << ""<< endl;
  }
}

double dist(int i,int j){
  double dis;
  dis = pow(pow(double(x[i]-x[j]),2.0)+pow(double(y[i]-y[j]),2.0),0.5);
  return dis;
}

int inv_in(int b_num,int b_ind){
  int inv;
  for(int j=0;j<b_num;j++){
    if(index_[j]==b_ind){
      inv = j;
      break;
    }
  }
  return inv;
}