#include<iostream>
#include<cmath>
#include<stack>
#include<algorithm>
using namespace std;

int main(){
  int n,m,b[1000],x[1000],y[1000],s,g;
  double dis[1001][1001];
  int route[1001][1001];

  while(1){
    cin >> n;
    if(!n)break;

    for(int i=0;i<n;i++)cin >> b[i] >> x[i] >> y[i];

    for(int i=0;i<n;i++){
      for(int j=i;j<n;j++){
	double d = sqrt( (x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]) );
	if(d>50.0)dis[b[i]][b[j]] = 1e+10;
	else dis[b[i]][b[j]] = d;
	dis[b[j]][b[i]] = dis[b[i]][b[j]];
	route[b[i]][b[j]] = b[i];
	route[b[j]][b[i]] = b[j];
      }
    }

    for(int k=1;k<=n;k++){
      for(int i=1;i<=n;i++){
	for(int j=1;j<=n;j++){
	  if(dis[i][j] > dis[i][k] + dis[k][j]){
	    dis[i][j] = dis[i][k] + dis[k][j];
	    route[i][j] = route[k][j];
	  }
	}
      }
    }
 
    cin >> m;
    for(int i=0;i<m;i++){
      cin >> s >> g;
      if(dis[s][g] >= 1e+10)cout << "NA" << endl;
      else{
	stack<int> a;
	while(s!=g){
	  a.push(g);
	  g = route[s][g];
	}
	cout << s;
	while(a.size()){
	  cout << " " << a.top();
	  a.pop();
	}
	cout << endl;
      }
    }
  }
}