#include<cstdio>
#include<cfloat>
#include<cmath>
#include<vector>
#include<queue>
#include<utility>
#include<algorithm>
#include<functional>
using namespace std;

const int MAX_N = 1001;
const double EPS = 1e-6;

typedef pair<double, int>P;	//<distance, index>
vector<vector<P> >edge(MAX_N);

#define Square(x) ((x)*(x))

double Distance(int x1, int x2, int y1, int y2)
{
	return sqrt((double)Square(x1-x2)+Square(y1-y2));
}

vector<int> Solve(int s, int g)
{
	//_CNXg@ÅA¸_s©ç¼ÌSÄÌ¸_ÜÅKvÈÅZ£ðßé
	double dist[MAX_N];	//dist[i] := ¸_iÉ½Çè­ÜÅÉKvÈÅZ£
	fill(dist, dist+MAX_N, DBL_MAX);

	typedef pair<double, int> P;	//<»Ì¸_ÜÅÌ£,¡¢é¸_>
	priority_queue<P, vector<P>, greater<P> >q;
	q.push(P(0,s));
	while(!q.empty())
	{
		P p(q.top());
		q.pop();

		double d = p.first;
		int id = p.second;
		if(dist[id] <= d)
			continue;
		dist[id] = d;

		for(int i=0; i<edge[id].size(); ++i)
			q.push(P(d+edge[id][i].first, edge[id][i].second));
	}

	//Bs\Å é
	if(dist[g] == DBL_MAX)
		return vector<int>();

	//oHðAS[©çX^[gÖü¯ÄAtÉ³
	vector<int> res;
	res.push_back(g);
	for(int id=g; id!=s; )
	{
		for(int i=0; i<edge[id].size(); ++i)
		{
			if( (dist[edge[id][i].second]+edge[id][i].first - dist[id]) < EPS )
			{
				id = edge[id][i].second;
				res.push_back(id);
				break;
			}
		}
	}
	return res;
}

int main()
{
	int n,b,x[MAX_N],y[MAX_N],m,s,g;
	int i,j;
	vector<int>id;
	while(scanf("%d",&n),n)
	{
		id.clear();
		for(i=0; i<n; ++i)
			edge[i].clear();
		for(i=0; i<n; ++i)
		{
			scanf("%d",&b);
			scanf("%d%d",&x[b],&y[b]);
			id.push_back(b);
		}
		
		//Ú®Â\È¸_¯mÉÓð\é
		for(i=0; i<id.size(); ++i)
		{
			for(j=i+1; j<id.size(); ++j)
			{
				int i1 = id[i];
				int i2 = id[j];
				double distance = Distance(x[i1],x[i2],y[i1],y[i2]);
				if( distance<=50 )
				{
					edge[i1].push_back(P(distance,i2));
					edge[i2].push_back(P(distance,i1));
				}
			}
		}

		vector<int> res;
		scanf("%d",&m);
		while(m--)
		{
			scanf("%d%d",&s,&g);
			res = Solve(s,g);
			if(res.empty())
				puts("NA");
			else
			{
				for(int i=res.size()-1; i>=0; --i)
					printf("%d%c",res[i], (i?' ':'\n'));
			}
		}
	}
	return 0;
}