#include <iostream>
#include <sstream>
#include <queue>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

const double eps = 1e-9;
const double inf = (double)(1<<24);
const int size = 1001;
int n;
int b[size], x[size], y[size];
bool p[size][size];
double c[size][size];

int CN[size][size];
int CNcnt[size];

double mc[size];
int prev[size];
typedef pair <double, int> Node;
typedef priority_queue <Node, vector<Node>, greater<Node> > QUEUE;

bool big_equal( double a, double b )
{
    return fabs( a - b ) < eps ? true : a < b;
}

double getdist( int x1, int y1, int x2, int y2 )
{
    double X = x2 - x1, Y = y2 - y1;
    return sqrt( X * X + Y * Y );
}

string solve( int s, int g )
{
    QUEUE Q;
    Node start( 0.0, s );
    Q.push( start );
    mc[s] = 0.0;

    while ( !Q.empty() ) {
        Node node = Q.top();
        Q.pop();

        double cost = node.first;
        int ind = node.second;

        if ( ind == g ) {
            vector <int> list;
            list.push_back( g+1 );
            int t = prev[g];
            while ( t != -1 ) {
                list.push_back( t+1 );
                t = prev[t];
            }
            reverse( list.begin(), list.end() );
            ostringstream os;
            for ( vector <int> ::iterator it = list.begin(); it != list.end(); it++ ) {
                os << *it;
                if ( it + 1 != list.end() ) os << " ";
            }
            return os.str();
        }

        for ( int i = 0; i < CNcnt[ind]; i++ ) {
            int next_ind = CN[ind][i];
            double next_cost = node.first + c[ind][next_ind];
            if ( big_equal( mc[next_ind], next_cost ) ) {
                continue;
            }
            mc[next_ind] = next_cost;
            prev[next_ind] = ind;
            Node next_node( next_cost, next_ind );
            Q.push( next_node );
        }
    }

    return "NA";
}

int main()
{
    while ( cin >> n && n ) {
        // init
        for ( int i = 0; i < n; i++ ) {
            CNcnt[i] = 0;
            for ( int j = 0; j < n; j++ ) {
                p[i][j] = false;
                c[i][j] = inf;
            }
        }

        // input
        for ( int i = 0; i < n; i++ ) {
            cin >> b[i];
            int ind = b[i] - 1;
            cin >> x[ind] >> y[ind];
        }

        // proc
        for ( int i = 0; i < n; i++ ) {
            for ( int j = 0; j < n; j++ ) {
                if ( i == j ) continue;
                c[i][j] = getdist( x[i], y[i], x[j], y[j] );
                if ( big_equal( c[i][j], 50.0 ) ) {
                    p[i][j] = true;
                    CN[i][CNcnt[i]++] = j;
                }
            }
        }

        int m;
        cin >> m;
        for ( int i = 0; i < m; i++ ) {
            for ( int j = 0; j < n; j++ ) {
                mc[j] = inf;
                prev[j] = -1;
            }

            int s, g;
            cin >> s >> g;
            cout << solve( s-1, g-1 ) << endl;
        }
    }
    return 0;
}