#include<bits/stdc++.h>
#define N 205
using namespace std;
typedef pair<int,int> P;
typedef pair<long double,P> P1;

struct point{
  long double x,y,z;
};

int n;
point p[N],v[N];
long double r[N],vr[N];
const long double EPS=(1e-9);

long double getd(long double T,int a,int b){
  
  long double X=(p[a].x+T*v[a].x)-(p[b].x+T*v[b].x);
  long double Y=(p[a].y+T*v[a].y)-(p[b].y+T*v[b].y);
  long double Z=(p[a].z+T*v[a].z)-(p[b].z+T*v[b].z);
  
  return sqrt(X*X+Y*Y+Z*Z);
}

long double getTime2(long double T,int a,int b){
  
  long double L=0,R=T;
  
  int cnt=100;
  
  while(cnt--){
    
    long double M=(L+R)/2.0;
    long double X=r[a]-M*vr[a]+r[b]-M*vr[b];
    
    if(getd(M,a,b)>X) L=M;
    else R=M;
    
  }
  
  return L;
}

long double getTime(int a,int b){
  
  long double L=0,R=min(r[a]/vr[a],r[b]/vr[b]);
  
  int cnt=100;
  
  while(cnt--){
    
    long double M=(L+R)/2.0;
    long double pX=r[a]-M*vr[a]+r[b]-M*vr[b];
    long double X=r[a]-(M+EPS)*vr[a]+r[b]-(M+EPS)*vr[b];
    
    if(getd(M,a,b)-pX>getd(M+EPS,a,b)-X) L=M;
    else R=M;
    
  }
  
  long double X=r[a]-L*vr[a]+r[b]-L*vr[b];
  
  if(getd(L,a,b)<X) return getTime2(L,a,b);
  return (1e9);
}

int main(){
  
  while(1){
    
    cin>>n;
    if(!n) break;
    
    for(int i=0;i<n;i++){
      cin>>p[i].x>>p[i].y>>p[i].z;
      cin>>v[i].x>>v[i].y>>v[i].z;
      cin>>r[i]>>vr[i];
    }
    
    bool used[N];
 
    memset(used,0,sizeof(used));

    priority_queue<P1,vector<P1>,greater<P1> > q;
    
    for(int i=0;i<n;i++)
      q.push(P1(r[i]/vr[i],P(i,i)));
    
    for(int i=0;i<n;i++)
      for(int j=i+1;j<n;j++)
	q.push(P1(getTime(i,j),P(i,j)));
    
    long double ans[N];
    
    while(!q.empty()){
      
      P1 t=q.top(); q.pop();
      
      long double T=t.first;
      int a=t.second.first;
      int b=t.second.second;
      
      if(used[a]||used[b]) continue;
      
      used[a]=used[b]=true;
      
      ans[a]=ans[b]=T;
      
    }
    
    for(int i=0;i<n;i++) printf("%.10Lf\n",ans[i]);
    
  }
  
  return 0;
}