import std.stdio;
import std.typecons;
import std.algorithm;
import std.array;
import std.math;

alias Tuple!(int, "n", int, "x", int, "y") bill;

double len[1001][1001];
const double INF = 10000000;

void main(){
	int n;
	while(readf("%d\n", &n), n){
		for(int i=1;i<1001;i++)
			for(int j=1;j<1001;j++)
				len[i][j] = INF;

		bill[] bs;
		for(int i=n;i;i--){
			bill b;
			readf("%d %d %d\n", &b.n, &b.x, &b.y);
			bs ~= b;
		}

		for(int i=0;i<bs.length-1;i++){
			for(int j=i+1;j<bs.length;j++){
				double x = bs[i].x-bs[j].x, y = bs[i].y-bs[j].y, dist = sqrt(x*x+y*y);
				if(dist <= 50){
					len[bs[i].n][bs[j].n] = dist;
					len[bs[j].n][bs[i].n] = dist;
				}
			}
		}

		int m;
		readf("%d\n", &m);
		for(;m;m--){
			int start, end;
			readf("%d %d\n", &start, &end);
			int[] res = dijkstra(start, end);
			if(res[0] == -1)writeln("NA");
			else{
				for(int i=0;i<res.length;i++){
					write(res[i], i+1-res.length?" ":"\n");
				}
			}
		}
	}
}

int[] dijkstra(int s, int e){
	double dist[1001]; int used[1001]; int prev[1001];
	for(int i=1;i<1001;i++)dist[i] = INF;

	dist[s] = 0;
	while(1){
		int v = -1;
		for(int u=1;u<1001;u++){
			if(!used[u] && (v==-1 || dist[u]<dist[v]))v=u;
		}
		if(v == -1)break;
		used[v] = 1;
		for(int u=1;u<1001;u++){
			if(dist[u] > dist[v]+len[v][u])
				dist[u] = dist[v]+len[v][u], prev[u] = v;
		}
	}
	if(dist[e] == INF)return [-1];
	else{
		int[] res = [e];
		int v = e;
		while(v != s){
			v = prev[v];
			res ~= v;
		}
		res.reverse;
		return res;
	}
}