#include <iostream>
#include <vector>
#include <queue>
#include <cstring>
#include <cmath>

using namespace std;

struct Edge {
	int to;
	double d;
	Edge (int _t, double _d) : to(_t), d(_d) {}
};

bool operator > (const Edge& e1, const Edge& e2) {
	if (e1.d > e2.d) return true;
	return false;
}

struct Buil {
	int id;
	double x, y;
	Buil (int _i, double _x, double _y) : id(_i), x(_x), y(_y) {}
};

double builDist(const Buil& b1, const Buil& b2) {
	return sqrt((b1.x - b2.x)*(b1.x - b2.x) + (b1.y - b2.y)*(b1.y - b2.y));
}

int n, m;
vector< Buil > buils;
vector< vector<Edge> > G;

double INF = 1e9;
double dist[1010];
int prev[1010];

void dks(int s, int g) {
	fill(dist, dist + 1010, INF);
	memset(prev, -1, sizeof(prev));	
	
	priority_queue<Edge, vector<Edge>, greater<Edge> > que;
	que.push(Edge(s, 0));
	dist[s] = 0;
	
	while (!que.empty()) {
		Edge e1 = que.top(); que.pop();
		
		for (int i = 0; i < G[e1.to].size(); i++) {
			Edge e2 = G[e1.to][i];
			
			if (dist[e2.to] > e1.d + e2.d) {
				dist[e2.to] = e1.d + e2.d;
				prev[e2.to] = e1.to;
				que.push(Edge(e2.to, e1.d + e2.d));
			}
		}
	}
	
	if (dist[g] == INF) cout << "NA" << endl;
	else {
		vector<int> path;
		path.push_back(g);
		int cnt = 0;
		for (int u = prev[g]; u != -1; u = prev[u]) {
			path.push_back(u);
		}
		int size = (int)path.size();
		for (int i = 0; i < size - 1; i++) {
			cout << path[size - 1 - i] << " ";
		}
		cout << path[0] << endl;
	}	
}

int main() {
	while (1) {
		cin >> n; if (n == 0) break;
		
		buils.clear();
		for (int i = 0; i < n; i++) {
			int b, x, y; cin >> b >> x >> y;
			buils.push_back(Buil(b, x, y));
		}
		
		G.assign(1010, vector<Edge>());
		for (int i = 0; i < (int)buils.size(); i++) {
			for (int j = i + 1; j < (int)buils.size(); j++) {
				double d = builDist(buils[i], buils[j]);
				if (d > 50) continue;
				G[buils[i].id].push_back(Edge(buils[j].id, d));
				G[buils[j].id].push_back(Edge(buils[i].id, d));
			}
		}
		
		cin >> m;
		for (int i = 0; i < m; i++) {
			int s, g; cin >> s >> g;
			dks(s, g);
		}
	}
	
	return 0;
}