Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"strings"
	"math"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	dd := make([][]int, 1000)
	for i := range dd {
		dd[i] = make([]int, 1000)
	}
	num := make([]int,1000)
	inv := make([]int, 1001)
	x := make([]int, 1000)
	y := make([]int, 1000)
	vv := make([]int, 1000)
	nowt := make([]float64, 1000)
	rev := make([]int, 1000)
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		for i := 0; i < n; i++ {
			scanner.Scan()
			buf1 := strings.Split(scanner.Text(), " ")
			num[i], _ = strconv.Atoi(buf1[0])
			x[i], _ = strconv.Atoi(buf1[1])
			y[i], _ = strconv.Atoi(buf1[2])
			inv[num[i]] = i
		}
		for i := 0; i < n; i++ {
			for j := 0; j < n; j++ {
				dd[i][j]=(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])
			}
		}
		scanner.Scan()
		m, _ := strconv.Atoi(scanner.Text())
		for i := 0; i < m; i++ {
			scanner.Scan()
			buf2 := strings.Split(scanner.Text(), " ")
			c, _ := strconv.Atoi(buf2[0])
			d, _ := strconv.Atoi(buf2[1])
			c = inv[c]
			d = inv[d]
			for j := 0; j < n; j++ {
				vv[j] = 0
				nowt[j]=999999999
				rev[j]=-1
			}
			nowt[c]=0
			for j := 0; j < n; j++ {
				M := 99999999
				at := 0
				for k := 0; k < n; k++ {
					if vv[k] == 0 && float64(M) > nowt[k] {
						M=int(nowt[k])
						at = k
					}
				}
				if M > 90000000 {
					break
				}
				vv[at]=1
				for k := 0; k < n; k++ {
					if vv[k] == 0 && dd[at][k]<=2500&&nowt[k]>nowt[at]+math.Sqrt(float64(dd[at][k])) {
						nowt[k]=nowt[at]+math.Sqrt(float64(dd[at][k]))
						rev[k] = at
					}
				}
			}
			if vv[d] == 0 {
				fmt.Println("NA")
			} else {
				stack := make([]int, 0)
				V := d
				for V != c {
					stack = append(stack, V)
					V = rev[V]
				}
				fmt.Print(num[c])
				for len(stack) > 0 {
					fmt.Printf(" %d", num[stack[len(stack)-1]])
					stack = stack[:len(stack)-1]
				}
				fmt.Println()
			}
		}
	}
}

C++: #include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#define dis(a,b) (a)*(a)+(b)*(b)
using namespace std;
void f(vector<int> v,int d[][1001],int p[],int k[],int c,int e,double s){
  int i;
  vector<int> w=v;
  if(c==e){
    if(p[c]==-1||p[c]>s){
      w.push_back(c);
      for(i=0;i<(int)w.size();i++)
	k[i]=w[i];
      k[i]=0;
      p[c]=s;
    }
  }else if(p[c]==-1||p[c]>s){
    w.push_back(c);
    p[c]=s;
    for(i=1;i<1001;i++){
      if(d[c][i]&&d[c][i]<=2500)
	f(w,d,p,k,i,e,s+sqrt((double)d[c][i]));
    }
  }
  return;
}
int main(){
  int i,j;
  int m,n;
  int k[1001],p[1001],x[1001],y[1001],d[1001][1001];
  int *b,*e,*g;
  vector<int> v;
  for(;;){
    cin>>n;
    if(n==0)
      break;
    memset(d,0,sizeof(d));
    g=new int[n];
    for(i=0;i<n;i++){
      cin>>g[i];
      cin>>x[g[i]]>>y[g[i]];
      for(j=0;j<i;j++){
	d[g[i]][g[j]]=dis(x[g[i]]-x[g[j]],y[g[i]]-y[g[j]]);
	d[g[j]][g[i]]=d[g[i]][g[j]];
      }
    }
    delete[]g;
    cin>>m;
    b=new int[m];
    e=new int[m];
    for(i=0;i<m;i++)
      cin>>b[i]>>e[i];
    for(i=0;i<m;i++){
      v.clear();
      memset(p,-1,sizeof(p));
      k[0]=0;
      f(v,d,p,k,b[i],e[i],0.0);
      if(k[0]){
	for(j=0;k[j+1];j++)
	  cout<<k[j]<<" ";
	cout<<k[j]<<endl;
      }else
	cout<<"NA"<<endl;
    }
    delete[]b;
    delete[]e;
  }
  return 0;
}

C++: #include <iostream>
#include <complex>
#include <vector>
#include <utility>
#define rep(i,k,n) for(int i=k;i<n;i++)
#define INF 100000
using namespace std;
typedef complex<double> point; 
void makeroad(vector< vector < pair<int,double> > > &road,point* mapl,int n){
  double tmp;
  rep(i,0,n)
    rep(j,i+1,n)
      if((tmp=abs(mapl[i]-mapl[j]))<=50){
	road[i].push_back(make_pair(j,tmp));

	road[j].push_back(make_pair(i,tmp));
      }
}
int* dijk(const int n, vector< vector< pair<int,double> >  >&list,int s,int g){
  int* keiro;
  int i,j,u;
  double minn;
  double *length;
  bool *check=new bool[n];
  length= new double[n];
  keiro=new int[n];
 
  for(i=0;i<n;i++){
    length[i]=INF;    check[i]=true; keiro[i]=n+1;}
  //rep(i,0,n)
    //cout<<keiro[i]<<'!'<<endl;
  length[s]=0.0;
  while(check[g]){
    minn=(double)INF;


  
    rep(j,0,n)
      if(check[j] && (minn>length[j]) ){
	u=j; minn=length[j];}
    //cout<<u<<"!?"<<endl;
    if(minn==INF) break;
    rep(i,0,list[u].size())
      if(list[u][i].second+length[u]<length[list[u][i].first]){
	length[list[u][i].first]=list[u][i].second+length[u];
	keiro[list[u][i].first]=u;
      }  
    check[u]=false;
  }
  
  return keiro;
}



int main(){
  int n,m,ts,tg,tt;
  int* ans;
  vector<int> anss;
  double ta,tb;
  cin>>n;
  while(n){

    point mapl[n]; 
    rep(i,0,n){
      cin>>tt>>ta>>tb;
      mapl[tt-1]=point(ta,tb);
    }
    //いったんビルの情報を取りましょう
    vector<vector<pair<int,double> > > road(n);//これが道になる
    makeroad(road,mapl,n);//makeroadはmaplでroadを作
    cin>>m;
    rep(i,0,m){
      cin>>ts>>tg;
      ans=dijk(n,road,ts-1,tg-1);   
      //      cout<<endl;
      if (ans[tg-1]>n) cout <<"NA"<<endl;
      else{
	tt=tg-1;
	anss.resize(n);
	int k=0;
	anss[k++]=tg-1;
	for(;ans[tt]!=ts-1;tt=ans[tt]){
	  anss[k++]=ans[tt];
	}
	anss[k++]=ts-1;
	
	rep(l,1,k)
	  cout<<anss[k-l]+1<<" ";
	cout<<anss[0]<<endl;
      }

    }
   
    cin>>n;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
 cout<<"hello,world";
 return 0;
}

C++: #include<iostream>
#include<complex>
#include<map>
#include<vector>
#include<algorithm>
#define INF 20000000
using namespace std;
typedef complex<double> P;
map<int,P>data;
double gr[1200][1200];


int prev[1200];
double d[1200];
int used[1200];
void dijkstra(int s){
	fill(d,d+1200,INF);
	fill(used,used+1200,false);
	fill(prev,prev+1200,-1);
	d[s]=0;
	while(true){
		int v=-1;
		for(int u=0;u<1200;u++){
			if(!used[u]&&(v==-1||d[u]<d[v]))v=u;
		}
		if(v==-1)break;
		used[v]=true;
		
		for(int u=0;u<1200;u++){
			if(d[u]>d[v]+gr[v][u]){
				d[u]=d[v]+gr[v][u];
				prev[u]=v;
			}
		}
	}
}
vector<int>get_path(int t){
	vector<int>path;
	for(;t!=-1;t=prev[t])path.push_back(t);
	reverse(path.begin(),path.end());
	return path;
}
int main(){
	int n;
		while(cin>>n &&n){
		fill((double*)gr,(double*)gr+1200*1200,INF);
		for(int i=0;i<n;i++){
			int b,x,y;
			cin>>b>>x>>y;
			data[b].real()=x;
			data[b].imag()=y;
		}
		for(map<int,P>::iterator itr=data.begin();itr!=data.end();itr++){
			for(map<int,P>::iterator it=data.begin();it!=data.end();it++){
				if(abs(itr->second-it->second)<=50 &&abs(itr->second-it->second)>0){
					gr[itr->first][it->first]=abs(itr->second-it->second);
				}
			}
		}
	
		int m;
		cin>>m;
		for(int i=0;i<m;i++){
			int a,b;
			cin>>a>>b;
			dijkstra(a);
			if(d[b]==INF){
				cout<<"NA"<<endl;
				continue;
			}
			else{
		
				vector<int>ans;
				ans=get_path(b);
				for(int i=0;i<ans.size();i++){
					if(i)cout<<" ";
					cout<<ans[i];
				}
				cout<<endl;
			}
		}
	}
}