#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

const double eps = 5e-3;

struct point {
  double x,y,z;
  point(){}
  point(double x, double y, double z):x(x),y(y),z(z){}
  point operator-(const point &t){
    return point(x-t.x,y-t.y,z-t.z);
  }
};

double abs(const point &a){
  return sqrt(a.x*a.x + a.y*a.y + a.z*a.z);
}

bool eq( double a, double b){
  return abs(a/b-b/a)<0.0001;
}

//                       a b c
//                       Q R P
const int possible[3][3] = { {1,1,0},
                             {0,1,1},
                             {1,0,1} };

bool determine(int p[3], int q[3], int depth, pair<int,int> out[3] ){
  if( depth == 3 ){
    for(int i = 0; i < depth; ++i){
      for(int j = i+1; j < depth; ++j){
        if( (out[i].first == out[j].first || out[i].second == out[j].second) ){
          return false;
        }
      }
    }
    return true;
  }
  for(int j = 0; j < 3; ++j){
    for(int k = 0; k < 3; ++k){
      if( possible[p[depth]][j] && possible[q[depth]][k] ){
        out[depth] = make_pair(j,k);
        if( determine(p,q,depth+1,out) ) return true;
      }
    }
  }
  return false;
}

int main()
{
  int T;
  cin >> T;
  for(int tc=0;tc<T;++tc){
    int n;
    pair<double,int> l[3];
    vector<point> vp;

    for(int i = 0; i < 3; ++i){
      //  QR , RP , PQ
      cin >> l[i].first;
      l[i].second = i;
    }
    // sort(l,l+3);

    cin >> n;
    for(int i = 0; i < n; ++i){
      point p; cin >> p.x >> p.y >> p.z;
      vp.push_back( p );
    }

    for(int a = 0; a < n; ++a){
      
      for(int b = 0; b < n; ++b){
        if( a == b ) continue;
        
        for(int c = 0; c < n; ++c){
          if( b == c || a == c ) continue;
          
          pair<double,int> tl[3];
          
          tl[0] = make_pair(abs(vp[a]-vp[b]),0);
          tl[1] = make_pair(abs(vp[b]-vp[c]),1);
          tl[2] = make_pair(abs(vp[c]-vp[a]),2);
          // sort(tl,tl+3);
          
          if( eq( tl[2].first / l[2].first, tl[1].first / l[1].first ) &&
              eq( tl[2].first / l[2].first, tl[0].first / l[0].first) ) {

            cout << c+1 << ' ' << a+1 << ' ' << b+1 << endl;
            /*
            int pp[3] = { l[2].second, l[1].second, l[0].second};
            int qq[3] = {tl[2].second,tl[1].second,tl[0].second};
            pair<int,int> res[3];
            determine(pp,qq,0,res);

            sort(res,res+3);

            cout << a << ' ' << b << ' ' << c << endl;
            for(int i = 0; i < 3; ++i){
              cout << res[i].first << ' ' << res[i].second << endl;
            }
            swap(res[0],res[2]);
            swap(res[1],res[2]);

            int id[3] = {a,b,c};
            for(int i = 0; i < 3; ++i){
              if( i ) cout << ' ';
              cout << 1+id[res[i].second];
            }
            cout << endl;
            */
          }
        }
      }
    }
  }
  return 0;
}