#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;

class Node{
public:
	int id;
	vector< int > e_to;
	vector< double> e_cost;
	int pre;
    
	bool def;
	int min_cost;
    
    Node(){
    	def = false;
		min_cost = -1;
		pre = -1;
	}
};

bool operator==(const Node& ot1, const Node& ot2){
	return ot1.min_cost == ot2.min_cost;
}
bool operator!=(const Node& ot1, const Node& ot2){
	return !(ot1 == ot2);
}
bool operator<(const Node& ot1, const Node& ot2){
	return ot1.min_cost < ot2.min_cost;
}
bool operator>(const Node& ot1, const Node& ot2){
	return ot1.min_cost > ot2.min_cost;
}
bool operator<=(const Node& ot1, const Node& ot2){
	return !(ot1 > ot2);
}
bool operator>=(const Node& ot1, const Node& ot2){
	return !(ot1 < ot2);
}

class Dijkstra{
	priority_queue< Node, vector< Node >, greater< Node > > que;
	vector< Node > nodes;
public:
	void Init(int node_num){
		nodes.clear();
		nodes.resize(node_num);
		for(int i = 0; i < node_num; ++i){
			nodes[i] = Node();
		}
	}

	void Put(int id, int to, double cost){
		nodes[id].id = id;
		nodes[id].e_to.push_back(to);
		nodes[id].e_cost.push_back(cost);
	}
	
    double Run(int s, int t){
		for(vector< Node >::iterator it = nodes.begin(); it != nodes.end(); ++it){
			it->min_cost = -1;
			it->def = false;
			it->pre = -1;
		}
		
		nodes[s].min_cost = 0;
		que.push(nodes[s]);

		while(!que.empty()){
			Node def_node = que.top();
			que.pop();
			
			if(def_node.def)continue;
			
			def_node.def = true;
			
			for(int i = 0; i < def_node.e_to.size(); ++i){
				int to = def_node.e_to[i];
				double cost = def_node.min_cost + def_node.e_cost[i];
				
				if(nodes[to].min_cost < 0 || cost < nodes[to].min_cost){
					nodes[to].min_cost = cost;
					nodes[to].pre = def_node.id;
					que.push(nodes[to]);
				}
			}
		}
		return nodes[t].min_cost;
	}

	void GetRoute(int t, vector< int > *route){
		int id = t;
		
		while(1){
			route->push_back(id);
			id = nodes[id].pre;
			
			if(nodes[id].pre == -1){
				route->push_back(id);
				break;
			}
		}
	}
};

int main(){
	int n, m, b, s, g;
	double cost;
	vector< int > x, y, route;
	Dijkstra dst;
	
	while(cin >> n, n){
		dst.Init(n);
		x.resize(n);
		y.resize(n);
		for(int i = 0; i < n; ++i){
			cin >> b;
			cin >> x[b - 1] >> y[b - 1];
		}
		
		for(int i = 0; i < n; ++i){
			for(int j = i + 1; j < n; ++j){
				if((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) <= 2500){
					dst.Put(i, j, sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])));
					dst.Put(j, i, sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])));
				}
			}
		}
		
		cin >> m;
		for(int i = 0; i < m; ++i){
			route.clear();
			cin >> s >> g;
			cost = dst.Run(s - 1, g - 1);
			if(cost < 0){
				cout << "NA" << endl;
			}else{
				dst.GetRoute(g - 1, &route);
				reverse(route.begin(), route.end());
				for(int j = 0; j < route.size(); ++j){
					cout << (j ? " " : "") << route[j] + 1;
				}
				cout << endl;
			}
		}
	}
    return 0;
}