#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define ALL(A)		(A).begin(),(A).end()
#define DUMP(A)    cout<<#A<<"="<<(A)<< endl
#define SIZE(A)    (int)((A).size())
using namespace std;
typedef long long ll;
typedef pair<double,int> P;

int main(){
    int N;
    for(;;){
        scanf("%d",&N);
        if(N==0) break;
        vector<pair<int,int> > bils(N);
        for(int i=0;i<N;i++){
            int b,x,y;
            scanf("%d%d%d",&b,&x,&y);
            bils[b-1]=make_pair(x,y);
        }
        vector<vector<double> > path(N,vector<double>(N));
        for(int i=0;i<N;i++){
            for(int j=0;j<N;j++){
                int d2=(bils[i].first-bils[j].first)*(bils[i].first-bils[j].first)+(bils[i].second-bils[j].second)*(bils[i].second-bils[j].second);
                if(d2<=2500) path[i][j]=sqrt(d2);
                else path[i][j]=-1;
            }
        }
        int M;
        scanf("%d",&M);
        for(int i=0;i<M;i++){
            int st,go;
            scanf("%d%d",&st,&go);
            vector<double> dist(N,-1);
            vector<int> bef(N);
            dist[st-1]=0;
            bef[st-1]=st-1;
            priority_queue<P,vector<P>,greater<P> > que;
            que.push(make_pair(0,st-1));
            while(!que.empty()){
                P now=que.top();
                que.pop();
                int at=now.second;
                if(dist[at]<now.first) continue;
                for(int i=0;i<N;i++){
                    if(path[at][i]!=-1 && (dist[i]==-1 || dist[i]>dist[at]+path[at][i])){
                        dist[i]=dist[at]+path[at][i];
                        bef[i]=at;
                        que.push(make_pair(dist[i],i));
                    }
                }
            }
            if(dist[go-1]==-1) printf("NA\n");
            else{
                vector<int> ps;
                int now=go-1;
                for(;;){
                    ps.push_back(now);
                    if(bef[now]==now) break;
                    now=bef[now];
                }
                reverse(ALL(ps));
                for(int i=0;i<ps.size()-1;i++){
                    printf("%d ",ps[i]+1);
                }
                printf("%d\n",ps.back()+1);
            }
        }
    }
}