#include <bits/stdc++.h>
using namespace std;

#define double long double

struct Point {
	int x, y;
	
	Point(int a = 0, int b = 0){
		x = a;
		y = b;
	}
};

struct Edge {
	int to;
	double cost;
	
	Edge(int a, double b){
		to = a;
		cost = b;
	}
};

struct State {
	int pos;
	double sum;
	vector<int> route;
	
	State(int a, double b, vector<int> c){
		pos = a;
		sum = b;
		route = c;
	}
	
	bool operator < (const State &t) const {
		return sum > t.sum;
	}
};

int norm(Point &a, Point &b)
{
	return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}	

int n;
Point b[2000];
double d[2000];
vector<int> v[2000];
vector<Edge> g[2000];

void search(int s)
{
	for (int i = 0; i < n; i++){
		v[i].clear();
		d[i] = 1e10;
	}
	
	priority_queue<State> que;
	que.push(State(s, 0.0, vector<int>(0)));
	for ( ;que.size(); que.pop()){
		State st = que.top();
		if (d[st.pos] < st.sum) continue;
		
		d[st.pos] = st.sum;
		v[st.pos] = st.route;
		v[st.pos].push_back(st.pos);
		
		for (int i = 0; i < g[st.pos].size(); i++){
			Edge &e = g[st.pos][i];
			if (d[e.to] < st.sum + e.cost) continue;
			que.push(State(e.to, st.sum + e.cost, v[st.pos]));
		}
	}
}

int main()
{
	while (scanf("%d", &n), n){
		for (int _ = 0; _ < n; _++){
			int B, x, y;
			scanf("%d %d %d", &B, &x, &y);
			b[--B] = Point(x, y);
		}
		
		for (int i = 0; i < n; i++){
			for (int j = 0; j < n; j++){
				if (i == j) continue;
				
				if (norm(b[i], b[j]) <= 50 * 50){
					g[i].push_back(Edge(j, sqrt(norm(b[i], b[j]))));
				}
			}
		}
		
		int m;
		scanf("%d", &m);
		for (int _ = 0; _ < m; _++){
			int s, g;
			scanf("%d %d", &s, &g);
			search(--s);
			
			if (v[--g].size() == 0){
				puts("NA");
				break;
			}
			
			for (int i = 0; i < v[g].size(); i++){
				if (i) printf(" ");
				printf("%d", v[g][i] + 1);
			}
			puts("");
		}
	}
	
	return 0;
}