#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <cfloat>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define EACH( v, c ) for ( auto &v : c )

#define ITER( c ) __typeof( (c).begin() )
#define IREP( c, it ) for ( ITER(c) it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

struct Building
{
	int num, x, y;

	Building( int n, int x, int y ) : num( n ), x( x ), y( y )
	{
		return;
	}
};

double distance( double x1, int y1, int x2, int y2 )
{
	return sqrt( pow( x1 - x2, 2 ) + pow( y1 - y2, 2 ) );
}

typedef pair<int,double> Edge;

VI dijkstra( vector< vector< Edge > > G, const int s, int t )
{
	const int V = G.size();

	vector< double > dist( V, DBL_MAX );
	dist[s] = 0;

	VI prev( V, -1 );

	priority_queue< pair<double,int>, vector< pair<double,int> >, greater< pair<double,int> > > que;
	que.push( MP( 0, s ) );

	while ( !que.empty() )
	{
		double d = que.top().fst;
		int cur = que.top().snd;
		que.pop();

		REP( i, 0, G[ cur ].size() )
		{
			int next = G[ cur ][i].fst;
			double cost = G[ cur ][i].snd;

			if ( dist[ next ] <= d + cost )
			{
				continue;
			}

			dist[ next ] = d + cost;
			prev[ next ] = cur;

			que.push( MP( d + cost, next ) );
		}
	}

	if ( dist[t] == DBL_MAX )
	{
		return VI();
	}

	VI res;

	while ( true )
	{
		res.PB( t + 1 );

		if ( prev[t] == -1 )
		{
			break;
		}

		t = prev[t];
	}

	reverse( ALL( res ) );

	return res;
}

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );

	while ( true )
	{
		int n;
		cin >> n;

		if ( !n )
		{
			break;
		}

		vector< Building > buils;

		REP( i, 0, n )
		{
			int num, x, y;
			cin >> num >> x >> y;

			num--;

			buils.PB( Building( num, x, y ) );
		}

		vector< vector< Edge > > G( n );

		REP( i, 0, n )
		{
			REP( j, i + 1, n )
			{
				double dist = distance( buils[i].x, buils[i].y, buils[j].x, buils[j].y );

				if ( dist <= 50 )
				{
					G[i].PB( MP( j, dist ) );
					G[j].PB( MP( i, dist ) );
				}
			}
		}

		int m; 
		cin >> m;

		REP( i, 0, m )
		{
			int s, t;
			cin >> s >> t;

			s--;
			t--;

			VI path = dijkstra( G, s, t );

			if ( path.size() == 0 )
			{
				cout << "NA" << endl;
			}
			else
			{
				REP( j, 0, path.size() )
				{
					if ( j )
					{
						cout << ' ';
					}

					cout << path[j];
				}
				cout << endl;
			}
		}
	}

	return 0;
}