#include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <queue>
using namespace std;
const double EPS = 1e-10;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()

typedef complex<double> P;
typedef vector<P> VP;
struct L : array<P, 2>{
    L(const P& a, const P& b){ at(0)=a; at(1)=b; }
    L(){}
};
namespace std{
    bool operator < (const P& a, const P& b){
        return !EQ(a.X,b.X)? a.X<b.X : a.Y+EPS<b.Y;
    }
    bool operator == (const P& a, const P& b){
        return abs(a-b) < EPS;
    }
}
double dot(P a, P b){
    return (conj(a)*b).X;
}
double cross(P a, P b){
    return (conj(a)*b).Y;
}
int ccw(P a, P b, P c){
    b -= a;
    c -= a;
    if(cross(b,c) > EPS) return +1; //ccw
    if(cross(b,c) < -EPS) return -1; //cw
    if(dot(b,c) < -EPS) return +2; //c-a-b
    if(abs(c)-abs(b) > EPS) return -2; //a-b-c
    return 0; //a-c-b
}

bool intersectSP(const L& s, const P &p){
    return abs(cross(s[0]-p, s[1]-p))<EPS  && dot(s[0]-p, s[1]-p)<EPS;
}
bool intersectSS(const L& a, const L& b){
    return ( ccw(a[0],a[1],b[0]) *ccw(a[0],a[1],b[1]) <= 0 ) &&
        ( ccw(b[0],b[1],a[0]) *ccw(b[0],b[1],a[1]) <= 0 );
}

int main(){
    while(1){
        int n;
        cin >> n;
        if(n==0) break;

        vector<L> ls(n);
        for(int i=0; i<n; i++){
            int xs,ys,xt,yt;
            cin >> xs >> ys >> xt >> yt;
            ls[i] = L(P(xs, ys), P(xt, yt));
        }

        int ans[10] = {};
        while(!ls.empty()){
            L beg = ls.back();
            ls.pop_back();
            vector<L> cluster(1, beg);
            queue<L> wait;
            wait.push(beg);
            while(!wait.empty()){
                L curr = wait.front();
                wait.pop();
                for(int i=0; i<(int)ls.size(); i++){
                    if(intersectSS(curr, ls[i])){
                        wait.push(ls[i]);
                        cluster.push_back(ls[i]);
                        ls.erase(ls.begin() +i);
                        i--;
                    }
                }
            }

            //各クラスタについて辺を分類
            int m = cluster.size();
            vector<vector<int> > ep(m, vector<int>(2, 0)), mp(m, vector<int>(2, 0));
            int ee=0, ex=0, em=0, xm=0, mm=0;
            for(int i=0; i<m; i++){
                int endpoint=0, mid=0;
                for(int j=0; j<m; j++){
                    if(i==j) continue;
                    for(int d=0; d<2; d++){
                        if(cluster[i][d] == cluster[j][0] || cluster[i][d] == cluster[j][1]){
                            endpoint++;
                            ep[i][d]++;
                            continue;
                        }
                        if(intersectSP(cluster[j], cluster[i][d])){
                            mid++;
                            mp[i][d]++;
                        }
                    }
                }
                if(endpoint == 2){
                    ee++;
                }else if(endpoint == 1){
                    if(mid == 1) em++;
                    else ex++;
                }else{
                    if(mid == 2) mm++;
                    if(mid == 1) xm++;
                }
            }

            if(ee==3 && ex==2){
                int num = 0;
                VP ps(3);
                for(int i=0; i<m; i++){
                    for(int d=0; d<2; d++){
                        if(ep[i][d] == 0){
                            ps[num] = cluster[i][d];
                            num++;
                            ps[2] = cluster[i][1-d];
                        }
                    }
                }
                if(ccw(ps[0], ps[1], ps[2]) == 1){
                    ans[5]++;
                }else{
                    ans[2]++;
                }
            }else if(mm == 1){
                ans[8]++;
            }else if(xm == 1){
                ans[3]++;
            }else if(ee == 0){
                if(ex == 1){
                    ans[4]++;
                }else{
                    ans[1]++;
                }
            }else if(ee == 1){
                ans[7]++;
            }else if(ee == 2){
                ans[9]++;
            }else if(ee == 3){
                ans[6]++;
            }else{
                ans[0]++;
            }
        }

        for(int i=0; i<9; i++){
            cout << ans[i] << " ";
        }
        cout << ans[9] << endl;
    }
    return 0;
}


Measured memory_bytes: 3036