#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs
#include <cstdio>	// require printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>	// require tolower, toupper
#include <fstream>	// require freopen
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define DEBUG 0

using namespace std;

typedef long long ll;
typedef pair<double, int> P;
//typedef pair<double, int> pdi;

const int INF = 1000000000;

double adj[1005][1005];
int path[1005];
double d[1005];
int n;
bool visit[1005];

// ノード:s からの最短距離を求める
bool dijkstra (int s, int t )
{
	memset (path, -1, sizeof (d ) );
	memset (visit, false, sizeof (visit ) );
	// greater<P> を指定することでfirstが小さい順に取り出せるようにする
//	priority_queue<P, vector<P>, greater<P> > que;
	priority_queue<P> que;

	fill (d,  d + n, INF );
	d[s] = 0.0;
	que.push (P (0.0, s ) );
		
	while (!que.empty() ){
		P p = que.top(); que.pop();
		int u = p.second;
		if (u == t ) return true;
		visit[u] = true;
		if (d[u] < p.first ) continue;
		rep (v, n ){
			if (visit[v] ) continue;
			if (d[v] > d[u] + adj[u][v] ){
				d[v] = d[u] + adj[u][v];
				que.push (P (-d[v], v ) );
				path[v] = u;
			} // end if
		} // end rep
	} // end while

// for debug
#if DEBUG
	cout << "path: " << endl;
	rep (i, n ){
		cout << setw(2) << path[i];
	} // end rep
	cout << endl;
	cout << "dis: " << endl;
	rep (i, n ){
		cout << d[i] << ' ';
	} // end rep
	cout << endl;
#endif
	return false; 
}

void disp_path (int s, int t )
{
	vector<int> res;
	res.push_back (t );
	int curr = t;
	while (path[curr] != -1 ){
		curr = path[curr];
		res.push_back (curr );
	} // end while

	reverse (ALL (res ) );
	rep (i, res.size() ){
		cout << res[i] + 1 << (i != res.size() - 1 ? ' ' : '\n' );
	} // end rep
}

void disp_adj (void )
{
	rep (i, n+1 ){
		printf ("%-7d", i );
	} // end rep
	printf ("\n" );

	rep (i, n ){
		printf ("%-7d", i+1);
		rep (j, n ){
			if (adj[i][j] == INF ){
				printf ("INF   " );
			}else{
				printf ("%2.3lf", adj[i][j] );
			} // end if
		} // end rep
		printf ("\n" );
	} // end rep
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.spiderjin", "r", stdin );

	while (scanf ("%d", &n ) && n != 0 ){
//		memset (adj, -1, sizeof (adj ) );
		rep (i, n ) rep (j, n ) adj[i][j] = INF;
		vector<P> p;
		p.clear();
		rep (i, n ){
			int id, x, y;
			scanf ("%d %d %d", &id, &x, &y );
			p.push_back (P (x, y ) );
		} // end rep

		rep (i, n ){
			rep (j, n ){
				if (i == j ) continue;
				int xx = p[i].first - p[j].first;
				int yy = p[i].second - p[j].second;
				int dis = xx*xx + yy*yy;
				if (dis <= 50*50 ){
					adj[i][j] = sqrt (dis );
					adj[j][i] = sqrt (dis );
				} // end if
			} // end rep
		} // end rep
 
		disp_adj ();

		int m;
		scanf ("%d", &m );
		rep (i, m ){
			int s, t;
			scanf ("%d %d", &s, &t );
			s--, t--;
			if (dijkstra (s, t ) ){
				disp_path (s, t );
			}else{
				printf ("NA\n" );
			} // end if
		} // end rep
	} // end while
	
	return 0;
}