#include<iostream>
#include<iomanip>
using namespace std;
#include<vector>
#include<queue>
#include<limits>
template<typename T>
vector<int>dijkstra(int s,const vector<vector<pair<int,T> > >&G,T INF=numeric_limits<T>::max())
{
	int n=G.size();
	vector<T>d(n,INF);
	vector<int>parent(n,-1);
	priority_queue<pair<T,int>,vector<pair<T,int> >,greater<pair<T,int> > >P;
	d[s]=0;
	P.push(make_pair(d[s],s));
	while(!P.empty())
	{
		pair<T,int>p=P.top();P.pop();
		int v=p.second;
		if(d[v]<p.first)continue;
		for(const pair<int,T>&e:G[v])
		{
			int u=e.first;
			T cost=d[v]+e.second;
			if(d[u]>cost)
			{
				d[u]=cost;
				parent[u]=v;
				P.push(make_pair(d[u],u));
			}
		}
	}
	return parent;
}
#include<cmath>
#include<algorithm>
int x[100],y[100];
main()
{
	int N;
	while(cin>>N,N)
	{
		vector<vector<pair<int,double> > >G(N);
		for(int i=0;i<N;i++)
		{
			int b;cin>>b;b--;
			cin>>x[b]>>y[b];
		}
		for(int i=0;i<N;i++)for(int j=0;j<N;j++)
		{
			if(i==j)continue;
			double dis=hypot(x[i]-x[j],y[i]-y[j]);
			if(dis<=50)G[i].push_back(make_pair(j,dis));
		}
		int m;cin>>m;
		for(;m--;)
		{
			int s,g;cin>>s>>g;
			s--,g--;
			vector<int>p=dijkstra(s,G);
			if(p[g]==-1)cout<<"NA"<<endl;
			else
			{
				vector<int>ok;
				ok.push_back(g);
				while(ok.back()!=s)
				{
					ok.push_back(p[ok.back()]);
				}
				reverse(ok.begin(),ok.end());
				for(int i=0;i<ok.size();i++)
				{
					cout<<ok[i]+1<<(i+1==ok.size()?"\n":" ");
				}
			}
		}
	}
}

