#include <iostream>
#include <stdio.h>
#include <math.h>
#include <map>
#define MX 999999999
using namespace std;

multimap<double,int> mp;

struct bir {
	double x,y,m;
	int to[1001],fr;
};

bir b[1000];

multimap<double,int>::iterator it;

int search(int s,int e) {
	int n,i;
	double m,k;
	b[s].m=0; b[s].fr=-1; 
	mp.insert(multimap<double,int>::value_type(0,s));
	while(!mp.empty()) {
		it=mp.begin();
		n=(*it).second; m=(*it).first;
		mp.erase(it);
		if (b[n].m<m) continue;
		for (i=0;b[n].to[i]>=0;i++) {
			k=sqrt((b[n].x-b[b[n].to[i]].x)*(b[n].x-b[b[n].to[i]].x)+(b[n].y-b[b[n].to[i]].y)*(b[n].y-b[b[n].to[i]].y));
			if (b[b[n].to[i]].m>b[n].m+k) {
				mp.insert(multimap<double,int>::value_type(b[n].m+k,b[n].to[i]));
				b[b[n].to[i]].fr=n; b[b[n].to[i]].m=b[n].m+k;
			}
		}
	}
    if (b[e].m==MX) return 0;
	return 1;
}

int main() {
 int bn,i,j,k,n,s,e,an[1000],num[1001],rn[1001];
 while(cin >> bn) {
	 if (bn==0) break;
	 for (i=0;i<bn;i++) { cin >> num[i] >> b[i].x >> b[i].y; rn[num[i]]=i;}
	 for (i=0;i<bn;i++) {
		 for (j=0,k=0;j<bn;j++) if (i!=j) if ((b[i].x-b[j].x)*(b[i].x-b[j].x)+(b[i].y-b[j].y)*(b[i].y-b[j].y)<=2500) b[i].to[k++]=j; 
		 b[i].to[k]=-1; 
	 }
     cin >> n;
	 for (i=0;i<n;i++) {
		 cin >> s >> e;
		 s=rn[s]; e=rn[e];
		 for (k=0;k<1000;k++) b[k].m=MX;
		 if (search(s,e)==1) {
			 j=0;
			 while(e>=0) {an[j++]=num[e]; e=b[e].fr;}
			 for (;j>0;j--) { cout << an[j-1]; if (j>1) cout << ' ';}
			 cout << endl;
		 } else cout << "NA" << endl;
	 }
 }
return 0;
 }