#include<iostream>
#include<queue>
#define MAX 1000000
#include<complex>
#include<vector>
#include<cmath>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef complex<int> P;
int main(){
	int n,use[1001],m,s,g,now,pre[1001],box[1001],b,x,y;
	double v[1001],d[100][100];
	vector<P> vec;
	map<int,int> na,nb;
	while(cin>>n,n){
		rep(i,n)
		rep(j,n)
		d[i][j]=MAX;
		rep(i,n){
			cin>>b>>x>>y;
			vec.push_back(P(x,y));
			na[i]=b;
			nb[b]=i;
		}
		
		rep(i,vec.size()){
			for(int j=i+1;j<vec.size();j++){
				int p,q;
				y=vec[i].imag();
				x=vec[i].real();
				p=vec[j].imag();
				q=vec[j].real();
				if((x-q)*(x-q)+(y-p)*(y-p)<=2500){
					d[i][j]=(double)sqrt((x-q)*(x-q)+(y-p)*(y-p));
					d[j][i]=(double)sqrt((x-q)*(x-q)+(y-p)*(y-p));
				}
			}
		}
		cin>>m;
		rep(i,m){
			cin>>s>>g;
			s=nb[s];g=nb[g];
			//s=na[s];g=na[g];
			for(int i=0;i<n;i++){
				pre[i]=MAX;
				v[i]=MAX;
				use[i]=0;
			}
			v[s]=0;
			pre[s]=-1;
			now=s;
			bool update=true;
			while(update){
	//			cout<<"now       "<<now<<endl;
				//cout<<now<<endl;
				update=false;
				use[now]=1;
		//		cout<<now<<"   now";
				rep(i,n){
					//cout<<d[now][i]+v[now]<<' '<<v[i];
					if(d[now][i]+v[now]<v[i]){
						v[i]=d[now][i]+v[now];
						pre[i]=now;
						
					}
	//		cout<<' '<<update<<' '<<use[i]<<endl;
				}
				double f=50000;
				rep(i,n){
					if(use[i]==0&&f>v[i]){
						now=i;
						f=v[i];
						update=true;
						
					}
				}
			}
			//cout<<now<<endl;
			if(v[g]==MAX)
			cout<<"NA"<<endl;
			else{
				deque<int> que;
				now=g;
			//	cout<<"         ";
				while(now!=-1){
					que.push_back(na[now]);
					now=pre[now];
				}
				cout<<que.back();
				que.pop_back();
				while(!que.empty()){
						cout<<' ';
					
					cout<<que.back();
					que.pop_back();
				}
				cout<<endl;
				//cout<<d[s][g]<<endl;
			}
//			rep(i,n)
	//		cout<<i<<"         fd"<<v[i]<<endl;
			//cout<<d[8][19]<<endl;
		}
		vec.clear();
		na.clear();
	}
	return 0;
}