# define _CRT_SECURE_NO_WARNINGS 1
# define _USE_MATH_DEFINES
# include <iostream>
# include <numeric>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <forward_list>
# include <map>
# include <stack>
using namespace std;
# define INF ((int)(1<<25))
# define REP(i,n) for(int i=0;i<(int)n;i++)
# define FOR(i,n) REP(i,n)
# define TORAD 2.0*M_PI/360.0
# define INT(x) int x;cin>>x;
# define ALL(x) (x).begin(),(x).end()
# define RALL(x) (x).rbegin(),(x).rend()
# define DEBUG(x) cout<<#x<<" :"<<x<<endl;
# define EPS 1e-12
template<class T> void debug(T a) { for (auto i : a)cout << i << endl; }
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
int dx[4] = { 0,1,0,-1 }, dy[4] = { -1,0,1,0 };



int main()
{
	int n;
	while (cin >> n&&n)
	{
		vector<piii> a;
		vector<double> d[1001];
		FOR(i, n)
		{
			piii x; cin >> x.first >> x.second.first >> x.second.second;
			a.push_back(x);
		}
		FOR(i, n)
		{
			FOR(j, n)
			{
				pii x = a[i].second;
				pii y = a[j].second;
				d[i].push_back(sqrt((x.first - y.first)*(x.first - y.first) + (x.second - y.second)*(x.second - y.second)));
			}
		}
		INT(m);
		while (m--)
		{
			typedef pair<double, vi> P;
			INT(start); INT(goal);
			priority_queue< P,vector<P>,greater<P> > que;
			double memo[1001];
			fill(begin(memo), end(memo), 9999999999999.0);
			memo[0] = 0;
			int f;
			for (int i = 0; i < n; i++)if (a[i].first == start)f = i;
			que.push(P(f, {f}));
			bool ok = false;
			while (!que.empty())
			{
				P now = que.top(); que.pop();
				int p = now.second.back();
				double k = now.first;
				if(a[p].first==goal)
				{
					ok = true;
					for (int i = 0; i < now.second.size();i++)
					{
						if (i)cout << " ";
						cout << a[now.second[i]].first;
					}
					break;
				}
				for (int i = 0; i < n; i++)
				{
					if (i == p||d[p][i]>50.0)continue;
					if (memo[i] > k + d[p][i])
					{
						memo[i] = k + d[p][i];
						P next = now;
						next.first += d[p][i];
						next.second.push_back(i);
						que.push(next);
					}
				}
			}
			if (!ok)cout << "NA";
			cout << endl;
		}
	}
}