#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
template<class T>
using Table = vector<vector<T>>;
const ld eps=1e-9;

//// < "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\a.txt" > "D:\D_Download\Visual Studio 2015\Projects\programing_contest_c++\Debug\b.answer"
struct bill {
	int id;
	ld x;
	ld y;
};
typedef ld Weight;
struct Edge {
	int src, dst;
	Weight weight;
	int id;
	Edge(int src_, int dst_, Weight weight_, const int id_) :
		src(src_), dst(dst_), weight(weight_), id(id_) { }
	Edge(int src, int dst, Weight weight) :
		src(src), dst(dst), weight(weight) { }
	Edge() :src(0), dst(0), weight(0) {

	}
};
vector<int>from;
pair<bool, vector<Weight>> spfa(const int v_num, const vector<vector<Edge>>&es, const int start) {
	vector<Weight>diss(v_num, INT_MAX);
	from = vector<int>(v_num, -1);
	queue<int>que;
	vector<bool>use(v_num);
	vector<int>count(v_num);
	que.emplace(start);
	diss[start] = 0;
	while (!que.empty()) {
		int src(que.front());
		que.pop();
		use[src] = false;
		for (auto e : es[src]) {
			const int d = e.dst;
			if (diss[src] + e.weight < diss[d]) {
				diss[d] = diss[src] + e.weight;
				from[d] = src;
				if (!use[d]) {
					use[d] = true;
					count[d]++;
					if (count[d] >= v_num)return make_pair(false, vector<Weight>());
					que.emplace(d);
				}
			}
		}
	}
	return make_pair(true, diss);
}
int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		vector<bill>bs;
		for (int i = 0; i < N; ++i) {
			int b; ld x, y; cin >> b >> x >> y;
			bs.push_back(bill{ b,x,y });
		}
		vector<vector<Edge>>es(N);
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				if (i == j)continue;
				ld dx = bs[i].x - bs[j].x;
				ld dy = bs[i].y - bs[j].y;
				ld dis = sqrt((dx*dx) + (dy*dy));
				if (dis- eps <= 50) {
					es[i].push_back(Edge(i, j, dis));
				}
			}
		}
		int M; cin >> M;
		while (M--) {
			int sid, gid;
			{
				int s, g; cin >> s >> g;
				for (int i = 0; i < N; ++i) {
					if (bs[i].id == s)sid = i;
					if (bs[i].id == g)gid = i;
				}
			}
			
			auto p(spfa(N, es, sid));
			if (p.second[gid] < 1e8) {
				vector<int>roots;
				roots.push_back(bs[gid].id);
				int now = gid;
				while (now != sid) {
					now = from[now];
					roots.push_back(bs[now].id);
				}
				reverse(roots.begin(), roots.end());
				for (int i = 0; i < roots.size(); ++i) {
					cout << roots[i];
					if (i == roots.size() - 1) {
						cout << endl;
					}
					else {
						cout << " ";
					}
				}
			}
			else {
				cout << "NA" << endl;
			}
		}
	}
	return 0;
}