#include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999

pii d[2000];
bool used[2000];
double pass[2000][2000];
int n;

void dijk(int s){
    rep(i,2000)d[i]=pii(INF,-1);
    rep(i,2000)used[i]=false;
    d[s]=pii(0,-1);
    
    while (1) {
        int v=-1;
        rep(u,n){
            if( !used[u]&&(v==-1||d[u].first<d[v].first) )v=u;
        }
        
        if(v==-1)break;
        
        used[v]=true;
        
        rep(u,n){
            if( d[u].first>d[v].first+pass[v][u] )
                d[u] = pii( d[v].first+pass[v][u] , v );
        }
    }
}


int main(){
    while(cin>>n){
        if(n==0)break;
        
        rep(i,2000)rep(j,2000) pass[i][j]=INF;
        int b[2000],x[2000],y[2000];
        double res;
        rep(i,n){
            cin>>b[i]>>x[i]>>y[i];
        }
        rep(i,n){
            rep(j,n){
                if(i==j)
                    pass[b[i]-1][b[i]-1]=0;
                else if( ( res=sqrt( (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]) ) )<=50+1e-9  ){
                    pass[b[i]-1][b[j]-1]=res;
                    pass[b[j]-1][b[i]-1]=res;
                }
            }
        }
        int m;
        cin>>m;
        rep(i,m){
            int s,g;
            cin>>s>>g;
            s--,g--;
            dijk(s);
            if(d[g].first==INF){cout<<"NA"<<endl;continue;}
            int tmp = g;
            vector<int> ans;
            while(tmp!=s){
                ans.pb(tmp);
                tmp = d[tmp].second;
            }
            ans.pb(s);
            reverse(all(ans));
            rep(i,ans.size()){
                if(i!=0)cout<<" ";
                cout<<ans[i]+1;
            }
            cout<<endl;
        }
    }
}