#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <map>
#include <set>
#include <cstring>
#include <climits>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))

using namespace std;

int n, x[1001], y[1001], m, s[1001], g[1001];
float amt[1001][1001], vtx[1001];
int pre[1001];
queue<int> que;
stack<int> out;

int main()
{
	while( cin >> n, n)
	{
		CLR(amt);

		FOR(i, 0, n)
		{
			int b;
			cin >> b >> x[i] >> y[i];
		}

		cin >> m;

		FOR(i, 0, m)
		{
			cin >> s[i] >> g[i];
			s[i]--;
			g[i]--;
		}

		FOR(j, 0, n)
			FOR(i, j, n)
			{
				if( i != j )
				{
					double dis =  sqrt( pow((float)(x[i] - x[j]), 2) + pow((float)(y[i] - y[j]), 2) );

					if(dis <= 50.0)
					{
						amt[j][i] = dis;
						amt[i][j] = dis;
					}
				}
			}
		
		FOR(k, 0, m)
		{
			que.push(s[k]);

			FOR(i, 0, n)
			{
				vtx[i] = INT_MAX;
			}
		
			vtx[s[k]] = 0;

			while(!que.empty())
			{
				int now = que.front();
				que.pop();

				FOR(tg, 0, n)
				{
					if( amt[now][tg] > 0 && now != tg && vtx[now] + amt[now][tg] < vtx[tg] )
					{
						vtx[tg] = vtx[now] + amt[now][tg];
						pre[tg] = now;
						que.push(tg);
					}
				}

			}

			if( vtx[g[k]] >= INT_MAX )
			{
				cout << "NA" <<endl;
			}
			else
			{
				int now = g[k];
				
				while( now != s[k] )
				{
					out.push(pre[now]);
					now = pre[now];
				}

				while( !out.empty() )
				{
					cout << out.top()+1 << " ";
					out.pop();
				}

				cout << g[k]+1 << endl;
			}
		}


	}

	return 0;

}