# AOJ 0155 Spider Jin

# Python3 2018.6.23 bal4u

# 最短経路問題



MAXLEN = 50

MAX = 100

INF = 0x7ffffffffffffff

x = [0]*(MAX+2)

y = [0]*(MAX+2)

dist = [INF]*(MAX+2)

pre = [0]*(MAX+2)

	

import heapq

def dijkstra(V, to, start, goal):

	global dist

	dist = [INF]*V

	Q = []

	dist[start] = 0

	heapq.heappush(Q, (0, start))

	while len(Q):

		t, s = heapq.heappop(Q)

		if s == goal: break

		if dist[s] < t: continue

		for i in to[s]:

			e, cost = i

			nt = t + cost

			if dist[e] > nt:

				dist[e] = nt

				heapq.heappush(Q, (nt, e))

				pre[e] = s

while 1:

	n = int(eval(input()))

	if n == 0: break

	for i in range(n):

		j, x_, y_ = list(map(int, input().split()))

		x[j], y[j] = x_, y_

	n += 1

	to = [[] for i in range(n)]

	for i in range(1, n):

		for j in range(1, n):

			dx, dy = x[i]-x[j], y[i]-y[j]

			dd = (dx**2 + dy**2)**0.5

			if dd <= MAXLEN:

				to[i].append((j, dd))

				to[j].append((i, dd))

	m = int(eval(input()))

	for i in range(m):

		s, g = list(map(int, input().split()))

		if s == g: print(s)

		else:

			dijkstra(n, to, s, g)

			if dist[g] == INF: print("NA")

			else:

				ans = []

				ans.append(g)

				while g != s:

					g = pre[g]

					ans.append(g)

				print((*ans[::-1]))

	

# AOJ 0155 Spider Jin

# Python3 2018.6.23 bal4u

# 最短経路問題



MAXLEN = 50

MAX = 100

INF = 0x7ffffffffffffff

x = [0]*(MAX+2)

y = [0]*(MAX+2)

dist = [INF]*(MAX+2)

pre = [0]*(MAX+2)

	

import heapq

def dijkstra(V, to, start, goal):

	global dist

	dist = [INF]*V

	Q = []

	dist[start] = 0

	heapq.heappush(Q, (0, start))

	while Q:

		t, s = heapq.heappop(Q)

		if s == goal: break

		if dist[s] < t: continue

		for e, cost in to[s]:

			nt = t + cost

			if dist[e] > nt:

				dist[e] = nt

				heapq.heappush(Q, (nt, e))

				pre[e] = s

while 1:

	n = int(eval(input()))

	if n == 0: break

	for i in range(n):

		j, x_, y_ = list(map(int, input().split()))

		x[j], y[j] = x_, y_

	n += 1

	to = [[] for i in range(n)]

	for i in range(1, n):

		for j in range(i+1, n):

			dx, dy = x[i]-x[j], y[i]-y[j]

			cost = (dx**2 + dy**2)**0.5

			if cost <= MAXLEN:

				to[i].append((j, cost))

				to[j].append((i, cost))

	m = int(eval(input()))

	for i in range(m):

		s, g = list(map(int, input().split()))

		if s == g: print(s)

		else:

			dijkstra(n, to, s, g)

			if dist[g] == INF: print("NA")

			else:

				ans = []

				ans.append(g)

				while g != s:

					g = pre[g]

					ans.append(g)

				print((*ans[::-1]))

	

# AOJ 0155 Spider Jin
# Python3 2018.6.23 bal4u
# 最短経路問題
MAXLEN = 50
MAX = 100
INF = 0x7FFFFFFFFFFFFFF
x = [0] * (MAX + 2)
y = [0] * (MAX + 2)
dist = [INF] * (MAX + 2)
pre = [0] * (MAX + 2)
import heapq


def dijkstra(V, to, start, goal):
    global dist
    dist = [INF] * V
    Q = []
    dist[start] = 0
    heapq.heappush(Q, (0, start))
    while len(Q):
        t, s = heapq.heappop(Q)
        if s == goal:
            break
        if dist[s] < t:
            continue
        for i in to[s]:
            e, cost = i
            nt = t + cost
            if dist[e] > nt:
                dist[e] = nt
                heapq.heappush(Q, (nt, e))
                pre[e] = s


while 1:
    n = int(eval(input()))
    if n == 0:
        break
    for i in range(n):
        j, x_, y_ = list(map(int, input().split()))
        x[j], y[j] = x_, y_
    n += 1
    to = [[] for i in range(n)]
    for i in range(1, n):
        for j in range(1, n):
            dx, dy = x[i] - x[j], y[i] - y[j]
            dd = (dx**2 + dy**2) ** 0.5
            if dd <= MAXLEN:
                to[i].append((j, dd))
                to[j].append((i, dd))
    m = int(eval(input()))
    for i in range(m):
        s, g = list(map(int, input().split()))
        if s == g:
            print(s)
        else:
            dijkstra(n, to, s, g)
            if dist[g] == INF:
                print("NA")
            else:
                ans = []
                ans.append(g)
                while g != s:
                    g = pre[g]
                    ans.append(g)
                print((*ans[::-1]))

# AOJ 0155 Spider Jin
# Python3 2018.6.23 bal4u
# 最短経路問題
MAXLEN = 50
MAX = 100
INF = 0x7FFFFFFFFFFFFFF
x = [0] * (MAX + 2)
y = [0] * (MAX + 2)
dist = [INF] * (MAX + 2)
pre = [0] * (MAX + 2)
import heapq


def dijkstra(V, to, start, goal):
    global dist
    dist = [INF] * V
    Q = []
    dist[start] = 0
    heapq.heappush(Q, (0, start))
    while Q:
        t, s = heapq.heappop(Q)
        if s == goal:
            break
        if dist[s] < t:
            continue
        for e, cost in to[s]:
            nt = t + cost
            if dist[e] > nt:
                dist[e] = nt
                heapq.heappush(Q, (nt, e))
                pre[e] = s


while 1:
    n = int(eval(input()))
    if n == 0:
        break
    for i in range(n):
        j, x_, y_ = list(map(int, input().split()))
        x[j], y[j] = x_, y_
    n += 1
    to = [[] for i in range(n)]
    for i in range(1, n):
        for j in range(i + 1, n):
            dx, dy = x[i] - x[j], y[i] - y[j]
            cost = (dx**2 + dy**2) ** 0.5
            if cost <= MAXLEN:
                to[i].append((j, cost))
                to[j].append((i, cost))
    m = int(eval(input()))
    for i in range(m):
        s, g = list(map(int, input().split()))
        if s == g:
            print(s)
        else:
            dijkstra(n, to, s, g)
            if dist[g] == INF:
                print("NA")
            else:
                ans = []
                ans.append(g)
                while g != s:
                    g = pre[g]
                    ans.append(g)
                print((*ans[::-1]))

-    while len(Q): +    while Q: -        for i in to[s]: -            e, cost = i +        for e, cost in to[s]: -        for j in range(1, n): +        for j in range(i + 1, n): -            dd = (dx**2 + dy**2) ** 0.5 -            if dd <= MAXLEN: -                to[i].append((j, dd)) -                to[j].append((i, dd)) +            cost = (dx**2 + dy**2) ** 0.5 +            if cost <= MAXLEN: +                to[i].append((j, cost)) +                to[j].append((i, cost))