#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <cmath>
#include <cfloat>
using namespace std;

typedef pair<double, int> di;

struct Node {
    int x, y;
    int from;
    double c;
    bool d;
    vector<di> tos;
};

int n;
vector<Node> ns;

bool dijkstra(int s, int t) {
    for (int i = 1; i <= n; i++) {
        ns[i].from = -1;
        ns[i].c = DBL_MAX;
        ns[i].d = false;
    }
    ns[s].c = 0.0;
    priority_queue<di, vector<di>, greater<di> > q;
    q.push(make_pair(0, s));
    while (!q.empty()) {
        di p = q.top();
        q.pop();
        int i = p.second;
        if (ns[i].d) {
            continue;
        }
        ns[i].d = true;
        if (i == t) {
            return true;
        }
        for (vector<di>::iterator it = ns[i].tos.begin(); it != ns[i].tos.end(); it++) {
            double cost = ns[i].c + it->first;
            int to = it->second;
            if (!ns[to].d && cost < ns[to].c) {
                ns[to].from = i;
                ns[to].c = cost;
                q.push(make_pair(cost, to));
            }
        }
    }
    return false;
}

int dist2(int x1, int y1, int x2, int y2) {
    return (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2);
}

int main() {
    while (cin >> n, n) {
        ns.clear();
        ns.resize(n+1);
        for (int i = 1; i <= n; i++) {
            int b;
            cin >> b;
            cin >> ns[b].x >> ns[b].y;
        }
        for (int i = 1; i <= n - 1; i++) {
            for (int j = i + 1; j <= n; j++) {
                int d2 = dist2(ns[i].x, ns[i].y, ns[j].x, ns[j].y);
                if (d2 <= 2500) {
                    double d = sqrt(d2);
                    ns[i].tos.push_back(make_pair(d, j));
                    ns[j].tos.push_back(make_pair(d, i));
                }
            }
        }
        int m;
        cin >> m;
        for (int i = 0; i < m; i++) {
            int s, t;
            cin >> s >> t;
            if (dijkstra(s, t)) {
                stack<int> ans;
                while (t != s) {
                    ans.push(t);
                    t = ns[t].from;
                }
                cout << s;
                while (!ans.empty()) {
                    cout << " " << ans.top();
                    ans.pop();
                }
                cout << endl;
            } else {
                cout << "NA" << endl;
            }
        }
    }
}