#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-3;

typedef pair<int, int> P;

int main()
{
	int n, m;
	while (cin >> n, n) {
		vector<int> X(n + 1), Y(n + 1);
		for (int i = 0, b; i < n; i++) {
			cin >> b;
			cin >> X[b] >> Y[b];

		}

		vector< vector< pair<double, int> > > bld(n + 1);
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j <= n; j++) {
				if (i != j && (X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j]) <= 2500) {
					bld[i].push_back(P(sqrt((X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j])), j));
					bld[j].push_back(P(sqrt((X[i] - X[j]) * (X[i] - X[j]) + (Y[i] - Y[j]) * (Y[i] - Y[j])), i));
				}
			}
		}
		cin >> m;
		for (int i = 0, s, g; i < m; i++) {
			cin >> s >> g;
			vector<bool> dec(n + 1, false);
			vector<double> ans(n + 1);
			priority_queue< pair<double, int> > pq;
			pq.push(pair<double, int>(0.0, -s));
			while (!pq.empty()) {
				const int num = -pq.top().second;
				ans[num] = -pq.top().first;
				dec[num] = true;
				for (auto da : bld[num]) {
					if(!dec[da.second])
						pq.push(pair<double, int>(-ans[num] - da.first, -da.second));
				}
				while (!pq.empty() && dec[-pq.top().second]) pq.pop();
			}
			if (dec[g]) {
				int tmp = g;
				vector<int> a;
				a.reserve(n);
				while (tmp != s) {
					for (auto da : bld[tmp]) {
						if (ans[da.second] <= ans[tmp] - da.first + eps && ans[da.second] >= ans[tmp] - da.first - eps) {
							a.push_back(tmp);
							tmp = da.second;
							break;
						}
					}
				}
				cout << s;
				for (int j = a.size() - 1; j >= 0; j--)
					cout << " " << a[j];
				cout << endl;
			}
			else
				cout << "NA" << endl;
		}
	}
	return 0;
}