#include <iostream>
#include <cmath>
#include <cstring>
#include <memory>
#include <map>

using namespace std;

#define REP(i, n)           for(int(i)=0;(i)<(n);++(i))
#define FILL(m,v)           memset(m, v, sizeof(m))

int b[1001], x[1001], y[1001];
double wf[1001][1001];
int rt[1001][1001];

const double inf = 1e12;
map<int,int> id, rid;

void trace(int s, int g){
    int r = rt[s][g];
    if(g == r){
        cout << " " << id[g];
        return;
    }
    trace(s,r);
    trace(r,g);
}

int main(){
    int n, m;
    while(cin >> n && n){
        FILL(x, 0);
        FILL(y, 0);
        FILL(rt, 0);
        REP(i,1001) REP(j,1001) wf[i][j] = inf;
        REP(i,n){
            cin >> b[i] >> x[i] >> y[i];
            id[i] = b[i];
            rid[b[i]] = i;
        }
        REP(i,n) REP(j,n){
            if(i == j){
                wf[i][j] = 0;
                continue;
            }
            int dist = (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]);
            if(dist <= 50*50){
                wf[i][j] = sqrt((double)dist);
                rt[i][j] = j;
            }
        }
        REP(k,n) REP(i,n) REP(j,n) {
            if(wf[i][j] > wf[i][k] + wf[k][j]){
                wf[i][j] = wf[i][k] + wf[k][j];
                rt[i][j] = k;
            }
        }

        cin >> m;
        int s,g;
        REP(i,m){
            cin >> s >> g;
            s = rid[s], g = rid[g];
            if(wf[s][g] == inf){
                cout << "NA" << endl;
                continue;
            }
            cout << id[s]; trace(s,g); cout << endl;
        }
    }
    return 0;
}