#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

const int INF = 1000000;
using namespace std;

void sub(vector<vector<double> >edge,int s,int g){
    vector<double> kyori(edge.size());
    for(int i=0;i<kyori.size();i++)kyori[i]=INF;
    kyori[s] = 0;
    priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q;
    q.push(make_pair(s,0));
    while(!q.empty()){
        pair<int,int> p = q.top();q.pop();

        if(kyori[p.first] < p.second) continue;
        for(int i=0;i<edge.size();i++){
            if(kyori[i] > kyori[p.first]+edge[p.first][i]){
                kyori[i] = kyori[p.first]+edge[p.first][i];
                q.push(make_pair(i,kyori[i]));
            }
        }
    }
    if(kyori[g] == INF){
        cout << "NA" << endl;
        return ;
    }else{
        int u = g;
        vector<int> prev;
        prev.push_back(u);
        while(u!=s){
            for(int i=0;i<edge.size();i++){
                if(i==u)continue;
                if(abs(kyori[u]-(kyori[i]+edge[i][u])) < 1){
                    u = i;
                    prev.push_back(u);
                    break;
                }
            }
        }
        for(int i=prev.size()-1;i>-1;i--){
            cout << prev[i] << " ";
        }
        cout << endl;

    }
}
void solve(int n){
    vector<pair<int,int> > v(1001);
    vector<vector<double> > edge(v.size(),vector<double>(v.size()));
    for(int i=0;i<v.size();i++){
        v[i] = make_pair(INF,INF);
    }
    for(int i=0;i<n;i++){
        int b,x,y;
        cin >> b >> x >> y;
        v[b] = make_pair(x,y);
    }
    for(int i=0;i<v.size();i++){
        for(int j=0;j<v.size();j++){
            if((v[i].first == INF && v[i].second==INF) ||
               (v[j].first == INF && v[j].second==INF)){
                edge[i][j] = INF;
            }else{
                double len = sqrt((v[i].first-v[j].first)*(v[i].first-v[j].first)+
                                  (v[i].second-v[j].second)*(v[i].second-v[j].second));
                if(len > 50){
                    edge[i][j] = INF;
                }else{
                    edge[i][j] = len;
                }
            }
        }
    }
    int m;
    cin >> m;
    for(int i=0;i<m;i++){
        int s,g;
        cin >> s >> g;
        sub(edge,s,g);
    }
}
int main(){
    while(true){
        int n;
        cin >> n;
        if(n==0)break;
        solve(n);
    }
    return 0;
}