#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<queue>
using namespace std;

#define INF 1000*1000

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

      double edge[n][n];
      for(int i=0;i<n;i++)
	for(int j=0;j<n;j++)
	  edge[i][j]=INF;

      for(int i=0;i<n;i++)
	for(int j=i+1;j<n;j++)
	  {
	    //	    cout<<i<<" "<<j<<"  "<<
	    //  (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])<<endl;
	    if((x[i]-x[j])*(x[i]-x[j])+
	       (y[i]-y[j])*(y[i]-y[j])<=2500)
	      {
		double tmp = sqrt((x[i]-x[j])*(x[i]-x[j])+
				 (y[i]-y[j])*(y[i]-y[j]));
		edge[i][j]=tmp;
		edge[j][i]=tmp;
		//cout<<"make_edge "<<i<<" "<<j<<endl;
	      }
	  }
      /*
      for(int i=0;i<n;i++,cout<<endl)
	for(int j=0;j<n;j++)
	  printf("%6.f ",edge[i][j]);
      */
      int m;
      cin>>m;
      for(int i=0;i<m;i++)
	{
	  int s,g;
	  cin>>s>>g;
	  //step,now,keiro
	  priority_queue<pair<double,pair<int,vector<int> > > >qu;
	  for(int i=0;i<n;i++)
	    if(b[i]==s)
	      qu.push(make_pair(0,make_pair(i,vector<int>())));

	  bool closed[n];
	  memset(closed,false,sizeof(closed));
	  vector<int> ans;
	  while(!qu.empty())
	    {
	      double step=-qu.top().first;
	      int now=qu.top().second.first;
	      vector<int> load=qu.top().second.second;
	      qu.pop();
	      load.push_back(b[now]);

	      //	      cout<<"step:"<<step<<" "<<now<<endl;
	      //for(int i=0;i<load.size();i++){cout<<load[i];if(i!=load.size()-1)cout<<" ";else cout<<endl;}


	      if(b[now]==g)
		{
		  ans=load;
		  break;
		}
	      if(closed[now])
		continue;
	      closed[now]=true;
	      for(int i=0;i<n;i++)
		{
		  if(edge[now][i]!=INF && !closed[i])
		    qu.push(make_pair(-(step+edge[now][i]),make_pair(i,load)));
		}
	    }
	  if(ans.empty())
	    cout<<"NA"<<endl;
	  else
	    {
	      for(int i=0;i<ans.size();i++)
		{
		  cout<<ans[i];
		  if(i!=ans.size()-1)
		    cout<<" ";
		  else
		    cout<<endl;
		}
	    }
	}
    }

}