#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <sstream>
using namespace std;

typedef vector< vector< double > > Array2D;
typedef vector< double > Array1D;

const double EPS = 10e-9;
const int SIZE = 1001;

class Building
{
public:
	Building( int _id, int _x, int _y ) : id( _id ), x( _x ), y( _y ){}
	double distance( const Building& b ) const
	{
		int x = this->x - b.x;
		int y = this->y - b.y;
		return sqrt( static_cast<double>( x * x + y * y ) );
	}

	bool operator<( const Building& b ) const
	{
		if( this->x < b.x ) return true;
		if( this->x > b.x ) return false;
		if( this->y < b.y ) return true;
		if( this->y > b.y ) return false;
		return this->id < b.id;
	}

	int id;
	int x;
	int y;
};

class Path
{
public:
	Path( int _now, double _cost, vector< int > _root ) : now( _now ), cost( _cost )
	{
		_root.push_back( now );
		root = _root;
	}
	Path next( int n, double cost ) const
	{
		Path ret = *this;
		ret.now = n;
		ret.cost += cost;
		ret.root.push_back( n );
		return ret;
	}
	bool operator<( const Path& p ) const
	{
		return this->cost < p.cost;
	}
	int now;
	double cost;
	vector< int > root;
};

void sortBuildingXY( vector< Building >* const pb )
{
	sort( pb->begin(), pb->end() );
}

void measure( vector< Building >& list, Array2D& d, int index )
{
	Building& o = list[ index ];
	for( int i = index + 1; i < list.size(); ++i ){
		Building& a = list[ i ];
		if( a.x - o.x > 50 ){
			break;
		}
		if( a.y - o.y > 50 || o.y - a.y > 50 ){
			continue;
		}
		double dis = o.distance( a );
		if( 50.0 - dis >= 0.0 ){
			d[ o.id ][ a.id ] = d[ a.id ][ o.id ] = dis;
		}
	}
}

string answear( Path& p )
{
	string ret;
	bool first = true;
	int size = p.root.size();
	for( int i = 0; i < size; ++i ){
		if( first ){
			first = false;
		}else{
			ret += ' ';
		}
		ostringstream ss;
		ss << p.root[ i ];
		string s;
		s = ss.str();
		ret += s;
	}
	return ret;
}

string solve( vector< Building >& list, Array2D& d, bool* past, int s, int g, int n )
{
	vector< Path > vec;
	Path start( s, 0.0, vector< int >() );
	for( int i = 0; i <= n; ++i ){
		if( d[ s ][ i ] > 0.0 ){
			vec.push_back( start.next( i, d[ s ][ i ] ) );
		}
	}
	past[ s ] = true;

	while( !vec.empty() ){
		sort( vec.begin(), vec.end() );
		vector< Path >::iterator itr = vec.begin();
		while( itr != vec.end() && past[ itr->now ] ){
			itr = vec.erase( itr );
		}
		if( vec.empty() ){
			return string( "NA" );
		}
		Path path = *itr;
		vec.erase( itr );
		int t = path.now;
		if( t == g ){
			return answear( path );
		}
		past[ t ] = true;
		for( int i = 0; i <= n; ++i ){
			if( !past[ i ] && d[ t ][ i ] > 0.0 ){
				vec.push_back( path.next( i, d[ t ][ i ] ) );
			}
		}
	}
	return string( "NA" );
}

int main()
{
	Array1D tmpArray;
	for( int i = 0; i < SIZE; ++i ){
		tmpArray.push_back( 0.0 );
	}

	int n;
	while( cin >> n && n ){
		Array2D distance;
		for( int i = 0; i < SIZE; ++i ){
			distance.push_back( tmpArray );
		}
		vector< Building > BuildingList;
		for( int i = 0; i < n; ++i ){
			int id, x, y;
			cin >> id >> x >> y;
			BuildingList.push_back( Building( id, x, y ) );
		}
		sortBuildingXY( &BuildingList );

		for( int i = 0; i < n; ++i ){
			measure( BuildingList, distance, i );
		}

		int m;
		cin >> m;
		for( int i = 0; i < m; ++i ){
			int s, g;
			bool past[ SIZE ];
			memset( past, 0, sizeof(past) );

			cin >> s >> g;
			cout << solve( BuildingList, distance, past, s, g, n ) << endl;
		}
	}
	return 0;
}