Language: C++

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace ConsoleApplication1
{
    struct Point : IComparable
    {
        internal int to;
        internal double dist;
 
        public Point(int to, double dist)
        {
            this.to = to;
            this.dist = dist;
        }
 
        public int CompareTo(object obj)
        {
            Point other = (Point)obj;
 
            if (other.dist - dist > 0) return 1;    // rev
            if (other.dist == dist) return 0;
            return -1;
        }
    }
 
    struct State
    {
        internal double dist;
        internal string path;
    }
 
    class Problem
    {
        readonly int INF = 1 << 20;
        readonly int n;
 
        Dictionary<int, List<Point>> adj;
        State[][] memo;
        bool[] flg;
 
        public Problem(int n)
        {
            this.n = n;
            adj = new Dictionary<int, List<Point>>();
            memo = new State[n + 1][];
            flg = new bool[n + 1];
        }
 
        public void MakeMap()
        {
            var points = new Dictionary<int, KeyValuePair<int, int>>();
 
            for (int i = 0; i < n; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                int id = int.Parse(input[0]);
                int x = int.Parse(input[1]);
                int y = int.Parse(input[2]);
 
                points.Add(id, new KeyValuePair<int, int>(x, y));
                adj.Add(id, new List<Point>());
            }
 
            for (int i = 1; i <= n; i++)
            {
                for (int j = i + 1; j <= n; j++)
                {
                    int dx = points[i].Key - points[j].Key;
                    int dy = points[i].Value - points[j].Value;
                    double dist = Math.Sqrt(dx * dx + dy * dy);
 
                    if (dist > 50) continue;
 
                    adj[i].Add(new Point(j, dist));
                    adj[j].Add(new Point(i, dist));
                }
            }
        }
 
        public string GetPath(int s, int t)
        {
            if (!flg[s])
            {
                Dijkstra(s);
                flg[s] = true;
            }
 
            return memo[s][t].path == "" ? "NA" : memo[s][t].path;
        }
 
        private void Dijkstra(int s)
        {
            bool[] visited = new bool[n + 1];
 
            State temp;
            temp.dist = INF;
            temp.path = "";
 
            var d = Enumerable.Repeat(temp, n + 1).ToArray();
            d[s].dist = 0;
            d[s].path = s.ToString();
 
            PriorityQueue<Point> PQ = new PriorityQueue<Point>();
            PQ.Enqueue(new Point(s, 0));
 
            while (PQ.Count > 0)
            {
                Point f = PQ.Dequeue();
                int u = f.to;
                visited[u] = true;
 
                if (d[u].dist < f.dist) continue;
 
                for (int i = 0; i < adj[u].Count; i++)
                {
                    int v = adj[u][i].to;
 
                    if (visited[v]) continue;
 
                    double sumDist = d[u].dist + adj[u][i].dist;
 
                    if (d[v].dist > sumDist)
                    {
                        d[v].dist = sumDist;
                        d[v].path = d[u].path + " " + v;
 
                        PQ.Enqueue(new Point(v, d[v].dist));
                    }
                }
            }
            memo[s] = (State[])d.Clone();
        }
    }
 
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();
 
            while (true)
            {
                int n = int.Parse(Console.ReadLine());
 
                if (n == 0) break;
 
                Problem pb = new Problem(n);
                pb.MakeMap();
 
                int m = int.Parse(Console.ReadLine());
 
                while (m-- > 0)
                {
                    string[] input = Console.ReadLine().Split(' ');
                    int s = int.Parse(input[0]);
                    int t = int.Parse(input[1]);
 
                    sb.AppendLine(pb.GetPath(s, t));
                }
            }
            Console.Write(sb);
        }
    }
 
    class PriorityQueue<T> where T : IComparable
    {
        List<T> heap;
        int size;
 
        public PriorityQueue()
        {
            heap = new List<T>();
        }
 
        public int Count { get { return size; } }
 
        public void Enqueue(T x)
        {
            heap.Add(x);
            int i = size++;
 
            while (i > 0)
            {
                int p = (i - 1) / 2;
 
                if (Compare(heap[p], x) <= 0) break;
 
                heap[i] = heap[p];
                i = p;
            }
            heap[i] = x;
        }
 
        public T Dequeue()
        {
            T ret = heap[0];
            T x = heap[--size];
 
            int i = 0;
            while (i * 2 + 1 < size)
            {
                int a = i * 2 + 1;
                int b = i * 2 + 2;
 
                if (b < size && Compare(heap[b], heap[a]) < 0)
                    a = b;
                if (Compare(heap[a], x) >= 0)
                    break;
 
                heap[i] = heap[a];
                i = a;
            }
            heap[i] = x;
            heap.RemoveAt(size);
            return ret;
        }
 
        private int Compare(T x, T y)
        {
            return y.CompareTo(x);
        }
    }
}

Compiler output:
a.cc:1:7: error: expected nested-name-specifier before 'System'
    1 | using System;
      |       ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
    2 | using System.Collections.Generic;
      |       ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
    3 | using System.Linq;
      |       ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
    4 | using System.Text;
      |       ^~~~~~
a.cc:9:5: error: expected class-name before '{' token
    9 |     {
      |     ^
a.cc:10:9: error: 'internal' does not name a type
   10 |         internal int to;
      |         ^~~~~~~~
a.cc:11:9: error: 'internal' does not name a type
   11 |         internal double dist;
      |         ^~~~~~~~
a.cc:13:15: error: expected ':' before 'Point'
   13 |         public Point(int to, double dist)
      |               ^~~~~~
      |               :
a.cc:19:15: error: expected ':' before 'int'
   19 |         public int CompareTo(object obj)
      |               ^~~~
      |               :
a.cc:19:30: error: 'object' has not been declared
   19 |         public int CompareTo(object obj)
      |                              ^~~~~~
a.cc:27:6: error: expected ';' after struct definition
   27 |     }
      |      ^
      |      ;
a.cc: In constructor 'ConsoleApplication1::Point::Point(int, double)':
a.cc:15:18: error: request for member 'to' in '(ConsoleApplication1::Point*)this', which is of pointer type 'ConsoleApplication1::Point*' (maybe you meant to use '->' ?)
   15 |             this.to = to;
      |                  ^~
a.cc:16:18: error: request for member 'dist' in '(ConsoleApplication1::Point*)this', which is of pointer type 'ConsoleApplication1::Point*' (maybe you meant to use '->' ?)
   16 |             this.dist = dist;
      |                  ^~~~
a.cc: In member function 'int ConsoleApplication1::Point::CompareTo(int)':
a.cc:21:34: error: no matching function for call to 'ConsoleApplication1::Point::Point(int&)'
   21 |             Point other = (Point)obj;
      |                                  ^~~
a.cc:13:16: note: candidate: 'ConsoleApplication1::Point::Point(int, double)'
   13 |         public Point(int to, double dist)
      |                ^~~~~
a.cc:13:16: note:   candidate expects 2 arguments, 1 provided
a.cc:8:12: note: candidate: 'constexpr ConsoleApplication1::Point::Point(const ConsoleApplication1::Point&)'
    8 |     struct Point : IComparable
      |            ^~~~~
a.cc:8:12: note:   no known conversion for argument 1 from 'int' to 'const ConsoleApplication1::Point&'
a.cc:8:12: note: candidate: 'constexpr ConsoleApplication1::Point::Point(ConsoleApplication1::Point&&)'
a.cc:8:12: note:   no known conversion for argument 1 from 'int' to 'ConsoleApplication1::Point&&'
a.cc:23:23: error: 'struct ConsoleApplication1::Point' has no member named 'dist'
   23 |             if (other.dist - dist > 0) return 1;    // rev
      |                       ^~~~
a.cc:23:30: error: 'dist' was not declared in this scope
   23 |             if (other.dist - dist > 0) return 1;    // rev
      |                              ^~~~
a.cc:24:23: error: 'struct ConsoleApplication1::Point' has no member named 'dist'
   24 |             if (other.dist == dist) return 0;
      |                       ^~~~
a.cc:24:31: error: 'dist' was not declared in this scope
   24 |             if (other.dist == dist) return 0;
      |                               ^~~~
a.cc: At global scope:
a.cc:31:9: error: 'internal' does not name a type
   31 |         internal double dist;
      |         ^~~~~~~~
a.cc:32:9: error: 'internal' does not name a type
   32 |         internal string path;
      |         ^~~~~~~~
a.cc:33:6: error: expected ';' after struct definition
   33 |     }
      |      ^
      |      ;
a.cc:37:9: error: 'readonly' does not name a type
   37 |         readonly int INF = 1 << 20;
      |         ^~~~~~~~
a.cc:38:9: error: 'readonly' does not name a type
   38 |         readonly int n;
      |         ^~~~~~~~
a.cc:40:9: error: 'Dictionary' does not name a type
   40 |         Dictionary<int, List<Point>> adj;
      |         ^~~~~~~~~~
a.cc:41:14: error: expected unqualified-id before '[' token
   41 |         State[][] memo;
      |              ^
a.cc:42:13: error: expected unqualified-id before '[' token
   42 |         bool[] flg;
      |             ^
a.cc:44:15: error: expected ':' before 'Problem'
   44 |         public Problem(int n)
      |               ^~~~~~~~
      |               :
a.cc:52:15: error: expected ':' before 'void'
   52 |         public void MakeMap()
      |               ^~~~~
      |               :
a.cc:83:15: error: expected ':' before 'string'
   83 |         public string GetPath(int s, int t)
      |               ^~~~~~~
      |               :
a.cc:83:16: error: 'string' does not name a type
   83 |         public string GetPath(int s, int t)
      |                ^~~~~~
a.cc:94:16: error: expected ':' before 'void'
   94 |         private void Dijkstra(int s)
      |                ^~~~~
      |                :
a.cc:136:6: error: expected ';' after class definition
  136 |     }
      |      ^
      |      ;
a.cc: In constructor 'ConsoleApplication1::Problem::Problem(int)':
a.cc:46:18: error: request for member 'n' in '(ConsoleApplication1::Problem*)this', which is of pointer type 'ConsoleApplication1::Problem*' (maybe you meant to use '->' ?)
   46 |             this.n = n;
      |                  ^
a.cc:47:13: error: 'adj' was not declared in this scope
   47 |             adj = new Dictionary<int, List<Point>>();
      |             ^~~
a.cc:47:23: error: 'Dictionary' does not name a type
   47 |             adj = new Dictionary<int, List<Point>>();
      |                       ^~~~~~~~~~
a.cc:47:34: error: expected primary-expression before 'int'
   47 |             adj = new Dictionary<int, List<Point>>();
      |                                  ^~~
a.cc:48:13: error: 'memo' was not declared in this scope
   48 |             memo = new State[n + 1][];
      |             ^~~~
a.cc:48:37: error: expected primary-expression before ']' token
   48 |             memo = new State[n + 1][];
      |                                     ^
a.cc:49:13: error: 'flg' was not declared in this scope
   49 |             flg = new bool[n + 1];
      |             ^~~
a.cc: In member function 'void ConsoleApplication1::Problem::MakeMap()':
a.cc:54:13: error: 'var' was not declared in this scope
   54 |             var points = new Dictionary<int, KeyValuePair<int, int>>();
      |             ^~~
a.cc:56:33: error: 'n' was not declared in this scope
   56 |             for (int i = 0; i < n; i++)
      |                                 ^
a.cc:58:17: error: 'string' was not declared in this scope
   58 |                 string[] input = Console.ReadLine().Split(' ');
      |                 ^~~~~~
a.cc:58:24: error: expected primary-expression before ']' token
   58 |                 string[] input = Console.ReadLine().Split(' ');
      |                        ^
a.cc:59:26: error: expected primary-expression before 'int'
   59 |                 int id = int.Parse(input[0]);
      |                          ^~~
a.cc:60:25: error: expected primary-expression before 'int'
   60 |                 int x = int.Parse(input[1]);
      |                         ^~~
a.cc:61:25: error: expected primary-expression before 'int'
   61 |                 int y = int.Parse(input[2]);
      |                         ^~~
a.cc:63:17: error: 'points' was not declared in this scope; did you mean 'Point'?
   63 |                 points.Add(id, new KeyValuePair<int, int>(x, y));
      |                 ^~~~~~
      |                 Point
a.cc:63:36: error: 'KeyValuePair' does not name a type
   63 |                 points.Add(id, new KeyValuePair<int, int>(x, y));
      |                                    ^~~~~~~~~~~~
a.cc:63:49: error: expected primary-expression before 'int'
   63 |                 points.Add(id, new KeyValuePair<int, int>(x, y));
      |                                                 ^~~
a.cc:63:54: error: expected primary-expression before 'int'
   63 |                 points.Add(id, new KeyValuePair<int, int>(x, y));
      |                                                      ^~~
a.cc:64:17: error: 'adj' was not declared in this scope
   64 |                 adj.Add(id, new List<Point>());
      |                 ^~~
a.cc:64:33: error: 'List' does not name a type
   64 |                 adj.Add(id, new List<Point>());
      |                                 ^~~~
a.cc:64:43: error: expected primary-expression before '>' token
   64 |                 adj.Add(id, new List<Point>());
      |                                           ^
a.cc:64:45: error: expected primary-expression before ')' token
   64 |                 adj.Add(id, new List<Point>());
      |                                             ^
a.cc:67:34: error: 'n' was not declared in this scope
   67 |             for (int i = 1; i <= n; i++)
      |                                  ^
a.cc:71:30: error: 'points' was not declared in this scope; did you mean 'Point'?
   71 |                     int dx = points[i].Key - points[j].Key;
      |                              ^~~~~~
      |                              Point
a.cc:73:35: error: 'Math' was not declared in this scope
   73 |                     double dist = Math.Sqrt(dx * dx + dy * dy);
      |                                   ^~~~
a.cc:77:21: error: 'adj' was not declared in this scope
   77 |                     adj[i].Add(new Point(j, dist));
      |                     ^~~
a.cc: In member function 'void ConsoleApplication1::Problem::Dijkstra(int)':
a.cc:96:17: error: structured binding declaration cannot have type 'bool'
   96 |             bool[] visited = new bool[n + 1];
      |                 ^~
a.cc:96:17: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:96:17: error: empty structured binding declaration
a.cc:96:20: error: expected initializer before 'visited'
   96 |             bool[] visited = new bool[n + 1];
      |                    ^~~~~~~
a.cc:99:18: error: 'struct ConsoleApplicatio