#include <bits/stdc++.h>
using namespace std;

using P = pair<double, int>;

struct edge {
    int to;
    double weight;
};

constexpr double INF = 1e10;

int main() {
    int n;
    while(cin >> n, n) {
        vector<int> x(n), y(n);
        for(int i=0; i<n; ++i) {
            int b;
            cin >> b;
            b--;
            cin >> x[b] >> y[b];
        }

        vector<vector<edge>> g(n);
        for(int i=0; i<n; ++i) {
            for(int j=0; j<n; ++j) {
                if(i != j && (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) <= 2500) {
                    g[i].push_back((edge){j, sqrt(hypot(x[i]-x[j], y[i]-y[j]))});
                }
            }
        }

        int m;
        cin >> m;
        for(int i=0; i<m; ++i) {
            int s, t;
            cin >> s >> t;
            s--; t--;
            vector<double> d(n, INF), prev(n, -1);
            d[s] = 0;
            priority_queue<P, vector<P>, greater<P>> que;
            que.push(make_pair(0, s));
            while(!que.empty()) {
                P p = que.top();
                que.pop();
                int v = p.second;
                if(d[v] < p.first) {
                    continue;
                }
                for(auto& e : g[v]) {
                    if(d[e.to] > d[v] + e.weight) {
                        d[e.to] = d[v] + e.weight;
                        prev[e.to] = v;
                        que.push(make_pair(d[e.to], e.to));
                    }
                }
            }
            if(d[t] == INF) {
                cout << "NA" << endl;
            } else {
                vector<int> path = {t+1};
                while(prev[t] != -1) {
                    path.push_back(prev[t]+1);
                    t = prev[t];
                }
                for(int i=path.size()-1; i>=0; --i) {
                    cout << path[i] << " \n"[i == 0] << flush;
                }
            }
        }
    }
}
