#include<iostream>
#include<iomanip>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define FOR(i, a, b) for(ll i = a; i < b; ++i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define INF (long long)1000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main(void) {
	while(true) {
		int n, m;
		cin>>n;
		if(n == 0) break;
		vector<P> bil(n);
		vector<vector<double> > p(n, vector<double>(n));
		REP(i, n) {
			ll b, x, y;
			cin>>b>>x>>y;
			--b;
			bil[b] = P(x, y);
		}
		REP(i, n) {
			REP(j, n) {
				if(i == j) continue;
				p[j][i] = p[i][j] = (bil[i].first - bil[j].first) * (bil[i].first - bil[j].first) + (bil[i].second - bil[j].second) * (bil[i].second - bil[j].second);
			}
		}
		cin>>m;
		REP(i, m) {
			int s, g;
			cin>>s>>g;
			--s;
			--g;
			priority_queue<P> que;
			vector<ll> d(n, INF * INF);
			vector<ll> bef(n, INF * INF);
			que.push(P(0, s));
			d[s] = 0;
			while(!que.empty()) {
				P np = que.top();
				que.pop();
				if(d[np.second] != np.first) continue;
				REP(j, n) {
					if(j == np.second) continue;
					if(p[np.second][j] <= 2500) {
						if(d[j] > d[np.second] + sqrt(p[np.second][j])) {
							d[j] = d[np.second] + sqrt(p[np.second][j]);
							que.push(P(d[j], j));
							bef[j] = np.second;
						}
					}
				}
			}
			if(d[g] == INF * INF) cout<<"NA"<<endl;
			else {
				vector<ll> pass;
				pass.pb(g);
				ll np = g;
				while(true) {
					pass.pb(bef[np]);
					if(bef[np] == s) break;
					np = bef[np];
				}
				REP(j, pass.size()) {
					cout<<pass[pass.size() - 1 - j] + 1;
					if(j != pass.size() - 1) cout<<" ";
					else cout<<endl;
				}
			}
		}
	}
}