/*****include*****/
#include <iostream>
#include <fstream>
#include <math.h>

/*****デバッグ定義*****/
//#define DEBUG
#define INF 10000
/*****マクロ定義*****/

/*****名前空間*****/
using namespace std;

/*****グローバル変数置き場*****/
typedef struct{
	int x;
	int y;
}Field;
Field field[1000];

/*****その他関数置き場*****/
void djikstra(int start,int goal,int buil_num){
	double *dis;
	bool *used;
	int *from;
	int *root;
	int buil;
	int i;
	double distance=0;
	dis = new double [buil_num];
	used = new bool [buil_num];
	from = new int [buil_num];
	root = new int [buil_num];
	for(int i=0;i<buil_num;i++){
		dis[i] = INF;
		used[i] = false;
		from[i] = i;
		root[i] = i;
	}
	dis[start] = 0;
	while(true){
		buil = -1;
		for(int i=0;i<buil_num;i++){
			if(!used[i] && (buil == -1 || dis[i] < dis[buil])){
				buil = i;
			}
		}
		if(buil == -1)	break;
		used[buil] = true;
		//cout << buil+1 << endl;
		for(int i=0;i<buil_num;i++){
			distance = sqrt(((double)field[buil].x - (double)field[i].x)*((double)field[buil].x - (double)field[i].x) + ((double)field[buil].y - (double)field[i].y) * ((double)field[buil].y - (double)field[i].y));
			//cout << i+1 << " " << distance << endl;
			if(dis[i] > dis[buil] + distance && distance <= 50){
				dis[i] = dis[buil] + distance;
				from[i] = buil;
			}
		}
	}
	
	/*for(int i=0;i<buil_num;i++){
		cout  << i+1 << " " << from[i]+1 << " " << dis[i] << endl;
	}
	cout << endl;*/
	int place;
	place = goal;
	i = 0;
	while(place != start){
		root[i] = place;
		//cout << i << " " << root[i] << endl;
		place = from[place];
		i++;
		if(place == from[place])	break;
	}
	root[i] = start;
	//cout << i << " " << root[i] << endl;
	//cout << i << endl;
	if(place != start)	cout << "NA" << endl;
	else{
		while(i != 0){
			cout << root[i]+1 << " ";
			i--;
		}
		cout << root[i]+1 << endl;
	}
	delete dis;
	delete used;
	delete from;
	delete root;
}
/*****main関数*****/
int main(){
	/*****ファイルオープン*****/
#ifdef DEBUG
	ofstream fout("output.txt");
	ifstream fin("input.txt");
	if(!fout || !fin){
		cout << "Can't open the file.\n";
		return;
	}
#endif
	/*****変数置き場*****/
	/*****処理部*****/
	int buil_num;
	int order_num;
	while(1){
		cin >> buil_num;
		if(buil_num == 0)	break;
		for(int i=0;i<buil_num;i++){
			int b_n,x_ax,y_ax;
			cin >> b_n >> x_ax >> y_ax;
			field[b_n-1].x = x_ax;
			field[b_n-1].y = y_ax;
		}
		cin >> order_num;
		for(int i=0;i<order_num;i++){
			int start,goal;
			cin >> start >> goal;
			djikstra(start-1,goal-1,buil_num);
		}
	}
	/*****処理終了後*****/
#ifdef DEBUG
	fout.close();
	fin.close();
#endif
	return 0;
}