#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<sstream>
#include<utility>
#include<map>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<int,double>P;
typedef struct d{int i,x,y;}d;
typedef struct q{int c,p,o,b[1005];}q;
vector<d>B;
vector<P>g[1005];
int N,M,S,G,c[1005];

struct Order{bool operator ()(q const&a, q const&b) const{return a.c>b.c;}};

void dij(int S,int G)
{
	memset(c,0x7f,sizeof(c));
	c[S]=0;
	priority_queue<q,vector<q>,Order>Q;
	q tmp={0,S,1};
	tmp.b[0]=S;
	Q.push(tmp);
	for(;!Q.empty();)
	{
		tmp=Q.top();Q.pop();
		if(tmp.p==G)
		{
			for(int i=0;i<tmp.o;i++)
				printf("%d%c",tmp.b[i],i==tmp.o-1?'\n':' ');
			return;
		}
		if(tmp.c>c[tmp.p])continue;
		for(int i=0;i<g[tmp.p].size();i++)
		{
			P np=g[tmp.p][i];
			if(c[np.first]>tmp.c+np.second)
			{
				c[np.first]=tmp.c+np.second;
				q ins={c[np.first],np.first,tmp.o+1};
				memcpy(ins.b,tmp.b,sizeof(tmp.b));
				ins.b[tmp.o]=np.first;
				Q.push(ins);
			}
		}
	}
	puts("NA");
}

int main()
{
	for(;scanf("%d",&N),N;)
	{
		B.clear();
		for(int i=0;i<N;i++)g[i].clear();
		for(int i=0;i<N;i++)
		{
			int x,y,b;
			scanf("%d%d%d",&b,&x,&y);
			d t={b,x,y};
			B.push_back(t);
		}
		for(int i=0;i<N;i++)
			for(int j=i;j<N;j++)
			{
				if(i!=j)
				{
					double l=sqrt((double)(B[i].x-B[j].x)*(B[i].x-B[j].x)+(B[i].y-B[j].y)*(B[i].y-B[j].y));
					if(l<=50.0)
					{
						g[B[i].i].push_back(make_pair(B[j].i,l));
						g[B[j].i].push_back(make_pair(B[i].i,l));
					}
				}
			}
		scanf("%d",&M);
		for(;M--;)
		{
			scanf("%d%d",&S,&G);
			dij(S,G);
		}
	}
}