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

struct state {
  double c;
  int id;
  state(){}
  state(double c,int id):c(c),id(id){}
  bool operator<(const state& st) const{
    return c > st.c;
  }
};

bool check( P a, P b ){
  return abs( a - b ) <= 50.0;
}

void dijk(int s,int g){
  priority_queue<state> q;
  vector<double> H(N,1e20);
  vector<int> R(N,-1);
  q.push( state(0,s) );
  H[s] = 0.0;
  R[s] = -1;
  while( !q.empty() ){
    state p = q.top(); q.pop();
    for(int to=0;to<N;to++){
      if( check( ps[p.id], ps[to] ) ){
        double nc = p.c + abs( ps[ p.id ] - ps[ to ] );
        if( H[ to ] > nc ){
          H[ to ] = nc;
          R[ to ] = p.id;
          q.push( state( nc, to ) );
        }
      }
    }
  }
  vector<int> ret;
  if( H[ g ] >= INF/10.0 ) {
    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 );
    }
  }
}