#include<iostream>
#include<queue>
#include<algorithm>
#include<cmath>
#include<vector>

using namespace std;

typedef struct{
  int num;
  int x;
  int y;
}BILL;
typedef pair<int,int> P;
const int INF = (1<<20);
const int MAX = 1001;
BILL bill[MAX];
int pre[MAX],node[MAX];
int n,m;

void init(){
  fill(pre,pre+MAX, -1);
  fill(node,node+MAX, INF);
}


double Getd(BILL a, BILL b){
  return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
void solve(int from, int to){

  init();
  node[from] = 0;
  priority_queue<P,vector<P>, greater<P> > Q;
  Q.push(P(node[from],from));
  //Q(distance,name)
  while(!Q.empty()){
    P now = Q.top(); Q.pop();
    for(int i = 1; i <= n; i++){
      int next = bill[i].num;
      if(Getd(bill[now.second],bill[i]) <= 50 && Getd(bill[now.second],bill[i]) > 0)
	if(node[next] > node[now.second]+Getd(bill[now.second],bill[i])){
	  //  cout << "come" << endl;
	  
	  //cout <<"able "   << now.second << " " << next << " " <<Getd(bill[now.second],bill[i]) << endl;
	  //cout << bill[now.second].x << " " << bill[now.second].y << endl;
	  node[next] = node[now.second]+Getd(bill[now.second],bill[i]);
	  Q.push(P(node[next],next));
	  pre[next] = now.second;
	}
    }
  }

  vector<int> V;
  int prec = to;
  if(node[to] == INF) cout << "NA";
  else {
    V.push_back(to);
    while(pre[prec] != -1){
      V.push_back(pre[prec]);
      prec = pre[prec];
    }
  }
  reverse(V.begin(),V.end());
  for(int i = 0; i < V.size(); i++){
    if(i) cout << " ";
    cout << V[i];
  }
  cout << endl;
}

int main(){
  while(cin >> n && n){
    for(int i = 1; i <= n; i++)
      cin >> bill[i].num >> bill[i].x >> bill[i].y;
    
    cin >> m;
    for(int i = 0; i < m; i++){
      int f,t;
      cin >> f >> t;
      solve(f,t);
    }
  }
  return 0;
}