#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <cfloat>
#include <cmath>

struct Building {
	int id;
	int x;
	int y;
	std::vector<int> edge_to;
	std::vector<double> dist_to;
};

int main()
{
	int n;
	while (true) {
		std::cin >> n;
		if (n==0) break;
		Building* bldgs = new Building[n];
		std::map<int,int> m_index;
		for (int i=0; i<n; i++) {
			std::cin >> bldgs[i].id >> bldgs[i].x >> bldgs[i].y;
			m_index.insert( std::make_pair(bldgs[i].id, i) );
		}
		for (int i=0; i<n; i++) {
			for (int j=i+1; j<n; j++) {
				int d = (bldgs[i].x - bldgs[j].x) * (bldgs[i].x - bldgs[j].x)
					+ (bldgs[i].y - bldgs[j].y) * (bldgs[i].y - bldgs[j].y);
				if (d <= 2500) {
					bldgs[i].edge_to.push_back(j); bldgs[i].dist_to.push_back(std::sqrt((double)d));
					bldgs[j].edge_to.push_back(i); bldgs[j].dist_to.push_back(std::sqrt((double)d));
				}
			}
		}
		double* dist = new double[n];
		int* p = new int[n];
		int m; std::cin >> m;
		for (int m_=0; m_<m; m_++) {
			int s, g;
			std::cin >> s >> g;
			for (int i=0; i<n; i++) { dist[i] = DBL_MAX; p[i] = -1; }
			int s_index = m_index[s];
			dist[s_index] = 0;
			p[s_index] = s_index;
			for (int k=0; k<n-1; k++) {
				for (int i=0; i<n; i++) {
					for (int j=0; j<bldgs[i].edge_to.size(); j++) {
						int v = bldgs[i].edge_to[j];
						int d = bldgs[i].dist_to[j];
						if (dist[v] - d > dist[i]) {
							dist[v] = dist[i] + d;
							p[v] = i;
						}
					}
				}
			}
			int g_index = m_index[g];
			std::stack<int> st;
			int index = g_index;
			bool reachable = true;
			while (true) {
				st.push(index);
				if (index == s_index) break;
				else if (p[index] == -1) {reachable = false; break; }
				index = p[index];
			}
			if (reachable) {
				std::cout << s; st.pop();
				while (!st.empty()) { std::cout << " " << bldgs[st.top()].id; st.pop(); }
			}
			else std::cout << "NA";
			std::cout << std::endl;
		}
		delete[] dist;
		delete[] p;
		delete[] bldgs;
	}
	return 0;
}

