#include<vector>
#include<cmath>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int n,m,s,g,t;
	while(cin>>n,n){
		double adj[n][n]; rep(i,n)rep(j,n)adj[i][j]=60;
		int x[n],y[n];
		rep(i,n)cin>>t>>x[i]>>y[i];
		rep(i,n)rep(j,i)adj[i][j]=adj[j][i]=hypot(x[i]-x[j],y[i]-y[j]);
		
		cin>>m;
		while(m--){
			cin>>s>>g,s--,g--;
			double cost[n]; rep(i,n)cost[i]=99999999; cost[s]=0;
			vector<vector<int> > path(n); path[s].push_back(s);
			
			vector<int> frontier,next; frontier.reserve(n),next.reserve(n);
			frontier.push_back(s);
			for(;cost[g]==99999999&&!frontier.empty();){
				next.clear();
				rep(i,frontier.size()){
					rep(j,n){
						t=frontier[i];
						if(adj[t][j]<=50&&cost[j]>cost[t]+adj[t][j]){
							cost[j]=cost[t]+adj[t][j];
							path[j]=path[t],path[j].push_back(j);
							next.push_back(j);
						}
					}
				}
				frontier=next;
			}
			if(cost[g]==99999999)cout<<"NA"<<endl;
			else{
				rep(i,path[g].size()){
					cout<<path[g][i]+1;
					if(i==path[g].size()-1)cout<<endl;
					else cout<<" ";
				}
			}
		}
	}
	return 0;
}