#include <climits>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <queue>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <cassert>

using namespace std;

const int MAX_V = 1001;
const int INF   = INT_MAX;

struct Edge {
  int to;
  int cost;
};

int          V;
vector<Edge> G[MAX_V];
int          d[MAX_V];
int          prev[MAX_V];

void dijkstra(int s) {
  typedef pair<int, int> P;
  priority_queue<P, vector<P>, greater<P> > que;
  fill(d, d + V, INF);
  fill(prev, prev + V, -1);
  d[s] = 0;
  que.push(P(0, s));
  while (!que.empty()) {
    P   p = que.top(); que.pop();
    int v = p.second;
    if (d[v] < p.first)
      continue;
    for (int i = 0; i < (int)G[v].size(); i++) {
      Edge e = G[v][i];

      if (d[e.to] > d[v] + e.cost) {
        d[e.to]    = d[v] + e.cost;
        prev[e.to] = v;
        que.push(P(d[e.to], e.to));
      }
    }
  }
}

vector<int> get_path(int t) {
  vector<int> path;

  for (; t != -1; t = prev[t]) {
    path.push_back(t);
  }
  reverse(path.begin(), path.end());
  return path;
}


struct Building {
  int x;
  int y;
};

int distance2(Building *b1, Building *b2) {
  int dx = b1->x - b2->x;
  int dy = b1->y - b2->y;
  return dx * dx + dy * dy;
}

int name[MAX_V];
int rname[MAX_V];
Building building[MAX_V];

int main() {
  while (true) {
    int n;
    cin >> n;
    if (n == 0)
      break;
    V = n;

    for (int i = 0; i < n; i++) {
      G[i].clear();
    }
    for (int i = 0; i < n; i++) {
      int b;
      cin >> b;
      name[i] = b;
      rname[b] = i;
      cin >> building[i].x >> building[i].y;
    }
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        Building *b1 = building + i;
        Building *b2 = building + j;
        int       d2 = distance2(b1, b2);

        if (d2 <= 50 * 50) {
          int d1 = sqrt(d2);
          Edge e1 = {j, d1};
          G[i].push_back(e1);
          Edge e2 = {i, d1};
          G[j].push_back(e2);
        }
      }
    }
    int m;
    cin >> m;
    for (int i = 0; i < m; i++) {
      int s;
      int g;
      cin >> s >> g;
      dijkstra(rname[s]);
      if (d[rname[g]] == INF) {
        cout << "NA" << endl;
      } else {
        vector<int> path = get_path(rname[g]);
        for (int j = 0; j < (int)path.size(); j++) {
          cout << name[path[j]];
          if (j < (int)path.size() - 1)
            cout << " ";
        }
        cout << endl;
      }
    }
  }
  return 0;
}