#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int N,M;
vector<P> ps;
const int INF = (1<<29);

int tw( int a ){ return a*a; }
int dis( P a, P b ){
  return tw( a.first - b.first ) + tw( a.second - b.second );
}
bool check( P a, P b ){
  return tw( a.first - b.first ) + tw( a.second - b.second ) <= tw( 50 );
}

void dijk(int s,int g){
  priority_queue<P,vector<P>,greater<P> > q;
  vector<int> H(N,INF);
  vector<int> R(N,-1);
  q.push( P(0,s) );
  H[s] = 0;
  R[s] = -1;
  while( !q.empty() ){
    P p = q.top(); q.pop();
    for(int to=0;to<N;to++){
      if( check( ps[p.second], ps[to] ) ){
        int nc = p.first + dis( ps[ p.second ], ps[ to ] );
        if( H[ to ] > nc ){
          H[ to ] = nc;
          R[ to ] = p.second;
          q.push( P( nc, to ) );
        }
      }
    }
  }
  vector<int> ret;
  if( H[ g ] == INF ) {
    cout << "NA" << endl; return;
  }
  for( int i = g; i != -1; i=R[i] ) 
    ret.push_back( i );
  
  reverse( ret.begin(), ret.end() );
  for( int i=0;i<(int)ret.size();i++ ){
    if( i ) cout << " ";
    cout << ret[i]+1;
  }
  cout << endl;
}

int main(){
  while( cin >> N && N ) {
    ps = vector<P>(N);
    for(int i=0;i<N;i++){
      int b,x,y; cin >> b >> x >> y; --b;
      ps[b] = P(x,y);
    }
    cin >> M;
    for(int i=0;i<M;i++){
      int s,g; cin >> s >> g; --s; --g;
      dijk( s, g );
    }
  }
}