#include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <sstream>

using namespace std;

#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))

typedef long long ll;

const int MAX_SIZE = 10000;

struct edge{
	int to;
	double cost;
};

typedef pair<double,int> P;
int V;

const int MAX_V = 5000;

vector<edge> G[MAX_V];
double d[MAX_V];
const int INF = 1000000000;

int prevv[MAX_V];

void dijkstra(int s){
	priority_queue<P,vector<P>,greater<P> > que;
	fill(d,d+MAX_V,INF);
	fill(prevv,prevv+MAX_V,-1);
	d[s] = 0;
	que.push(P(0,s));
	while(!que.empty()){
		P p = que.top();
		que.pop();
		int v = p.second;
		if(d[v] < p.first)
			continue;
		for(int i = 0; i < G[v].size(); i++){
			if(v==6){
//				cout<<endl;
			}
			edge e = G[v][i];
			if(d[e.to] > d[v] + e.cost){
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to],e.to));
				// »Ìm[hÖÌÅZ£oHðL^µÄ¨­
				prevv[e.to] = v;
			}
		}
	}
}

class Building{
public:
	int node;
	int x;
	int y;
};


int main(){

	int n;
	while(cin>>n&&n!=0){
		vector<Building> vb;
		for(int i = 0; i < n; i++){
			Building b;
			cin>>b.node>>b.x>>b.y;
			vb.push_back(b);
		}
		// »ê¼êÌgÝí¹ÉÎµÄµç×é
		for(int i = 0; i < vb.size(); i++){
			for(int j = i+1; j < vb.size(); j++){
				int dist = (vb[i].x-vb[j].x)*(vb[i].x-vb[j].x)+(vb[i].y-vb[j].y)*(vb[i].y-vb[j].y);
				// rÔÌ£Ìñæª2500Èº¾Á½êAGbWðÞ·Ô
				if(!(sqrt((double)dist)>50)){
					edge e;
					e.cost=sqrt((double)dist);
					e.to=vb[j].node;
					G[vb[i].node].push_back(e);

					e.cost=dist;
					e.to=vb[i].node;
					G[vb[j].node].push_back(e);
				}
			}
		}

		//dijkstra(1);
		//cout<<d[22]<<endl;

		int m;
		cin>>m;
		for(int i = 0; i < m; i++){
			int s,g;
			cin>>s>>g;
			dijkstra(s);
			if(d[g]==INF)
				cout<<"NA"<<endl;
			else{
			//	cout<<d[g]<<endl;
				vector<int> path;
				path.push_back(g);
				int cp=g;
				while(1){
					int np=prevv[cp];
					cp=np;
					path.push_back(cp);
					if(cp==s)
						break;
				}
				for(int j = 0; j < path.size(); j++){
					cout<<path[path.size()-1-j];
					if(j==path.size()-1)
						cout<<endl;
					else
						cout<<" ";
				}
			}
		}
		for(int i = 0; i < MAX_V; i++)
			G[i].clear();
	}

	return 0;
}