#include <cstdio>
#include <cstdlib>
#include <csetjmp>
#include <cmath>
#include <utility>
#include <stack>
#include <queue>
#include <list>

#define SQ(X) \
  ( (X) * (X) )
#define N 1000

using namespace std;

typedef pair<double,int> arw;

typedef struct Building
{
  int x;
  int y;
  int mark;
  int p;
  double j;
  list<arw> neighbor;

  Building (
    )
  {
    x = -1;
    y = -1;

    return ;
  }
} Building;

int
main (
  int   argc,
  char *argv[ ]
  )
{
  list<arw>::iterator it;
  int i, j;

  for ( ; ; )
  {
    Building d[ N + 1 ];
    jmp_buf cont;
    int n;

    scanf ( "%d", &n );
    if ( n == 0 ) break ;

    /* ビル情報入力 */
    for ( i = 0; i < n; ++i )
    {
      int b, x, y;

      scanf ( "%d%d%d", &b, &x, &y );
      d[ b ].x = x;
      d[ b ].y = y;
    }

    /* 隣接点データを構築 */
    for ( i = 1; i <= N; ++i )
    {
      if ( d[ i ].x == -1 ) continue ;

      for ( j = i + 1; j <= N; ++j )
      {
        int r2;

        if ( d[ j ].x == -1 ) continue ;

        r2 = SQ( d[ j ].x - d[ i ].x ) + SQ( d[ j ].y - d[ i ].y );
        if ( r2 <= SQ( 50 ) )
        {
          d[ i ].neighbor.push_back ( make_pair ( sqrt ( r2 ), j ) );
          d[ j ].neighbor.push_back ( make_pair ( sqrt ( r2 ), i ) );
        }
      }
    }

    scanf ( "%d", &n );
    while ( n-- )
    {
      priority_queue<arw, vector<arw>, greater<arw> > lis;
      int src, dst;

      scanf ( "%d%d", &src, &dst );

      /* 初期化 */
      for ( i = 0; i <= N; ++i )
      {
        d[ i ].mark = 0;
        d[ i ].p = 0;
        d[ i ].j = 1e8;
      }

      /* 総距離優先探索 */
      lis.push ( make_pair( 0., dst ) );
      if ( setjmp ( cont ) == 0 )
      {
        while ( !lis.empty ( ) )
        {
          const arw c = lis.top ( );
          lis.pop ( );

          if ( d[ c.second ].mark )
            continue ;

          if ( c.second == src )
          {
            for ( i = src; i != 0; i = d[ i ].p )
            {
              if ( i != src )
                putchar ( ' ' );
              printf ( "%d", i );
            }
            puts ( "" );

            longjmp ( cont, 1 );
          }

          for ( it = d[ c.second ].neighbor.begin ( ); it != d[ c.second ].neighbor.end ( ); ++it )
          {
            const double jt = c.first + it->first;

            if ( d[ it->second ].mark )
              continue ;

            if ( jt < d[ it->second ].j )
            {
              d[ it->second ].p = c.second;
              d[ it->second ].j = jt;
              lis.push ( make_pair ( jt, it->second ) );
            }
          }

          d[ c.second ].mark = 1;
        }
        puts ( "NA" );
      }
    }
  }

  return ( EXIT_SUCCESS );
}