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

int main() {
	bool judge = true;
	while (judge) {
		int n, m;
		int b[n], x[n], y[n], s[m], g[m];
		cin >> n;
		if (n == 0) {
			judge = false;
			return 0;
		}
		for (int i = 0; i < n; i++) cin >> b[i] >> x[i] >> y[i];
		cin >> m;
		for (int i = 0; i < m; i++) cin >> s[i] >> g[i];
		const int INF = 1000000;
		int dp[n][n];
		for (int i = 0; i < m; i++) {
			for (int j = 0; j < n; j++) {
				for (int k = 0; k < n; k++) {
					dp[j][k] = INF;
				}
			}
			dp[s[i] - 1][0] = 0;
			for (int j = 0; j < n; j++) {
				for (int k = 0; k < n - 1; k++) {
					if (dp[j][k] != INF) {
						for (int l = 0; l < n; l++) {
							int p = abs(x[j] - x[l]) * abs(x[j] - x[l]);
							int q = abs(y[j] - y[l]) * abs(y[j] - y[l]);
							if (l != j && p + q <= 2500) {
								dp[l][k + 1] = min(dp[l][k + 1], dp[j][k] + 1);
							}
						}
					}
				}
			}
			int t = 0;
			for (int j = 0; j < n; j++) {
				if (dp[g[i] - 1][j] != INF) {
					t = dp[g[i] - 1][j];
					break;
				}
			}
			if (t == 0) {
				cout << "NA" << endl;
			}
			else {
				int ans[t + 1] = { 0 };
				ans[t] = g[i] - 1;
				for (int j = t; j > 0; j--) {
					for (int k = 0; k < n; k++) {
						int p = abs(x[ans[j]] - x[k]) * abs(x[ans[j]] - x[k]);
						int q = abs(y[ans[j]] - y[k]) * abs(y[ans[j]] - y[k]);
						if (dp[k][j - 1] == j - 1 && p + q <= 2500) {
							ans[j - 1] = k;
							break;
						}
					}
				}
				for (int j = 0; j <= t; j++) {
					cout << ans[j] + 1 << ' ';
					if (j == t) {
						cout << endl;
					}
				}
			}
		}
	}
}
	
